composer.phar 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988889898899088991889928899388994889958899688997889988899989000890018900289003890048900589006890078900889009890108901189012890138901489015890168901789018890198902089021890228902389024890258902689027890288902989030890318903289033890348903589036890378903889039890408904189042890438904489045890468904789048890498905089051890528905389054890558905689057890588905989060890618906289063890648906589066890678906889069890708907189072890738907489075890768907789078890798908089081890828908389084890858908689087890888908989090890918909289093890948909589096890978909889099891008910189102891038910489105891068910789108891098911089111891128911389114891158911689117891188911989120891218912289123891248912589126891278912889129891308913189132891338913489135891368913789138891398914089141891428914389144891458914689147891488914989150891518915289153891548915589156891578915889159891608916189162891638916489165891668916789168891698917089171891728917389174891758917689177891788917989180891818918289183891848918589186891878918889189891908919189192891938919489195891968919789198891998920089201892028920389204892058920689207892088920989210892118921289213892148921589216892178921889219892208922189222892238922489225892268922789228892298923089231892328923389234892358923689237892388923989240892418924289243892448924589246892478924889249892508925189252892538925489255892568925789258892598926089261892628926389264892658926689267892688926989270892718927289273892748927589276892778927889279892808928189282892838928489285892868928789288892898929089291892928929389294892958929689297892988929989300893018930289303893048930589306893078930889309893108931189312893138931489315893168931789318893198932089321893228932389324893258932689327893288932989330893318933289333893348933589336893378933889339893408934189342893438934489345893468934789348893498935089351893528935389354893558935689357893588935989360893618936289363893648936589366893678936889369893708937189372893738937489375893768937789378893798938089381893828938389384893858938689387893888938989390893918939289393893948939589396893978939889399894008940189402894038940489405894068940789408894098941089411894128941389414894158941689417894188941989420894218942289423894248942589426894278942889429894308943189432894338943489435894368943789438894398944089441894428944389444894458944689447894488944989450894518945289453894548945589456894578945889459894608946189462894638946489465894668946789468894698947089471894728947389474894758947689477894788947989480894818948289483894848948589486894878948889489894908949189492894938949489495894968949789498894998950089501895028950389504895058950689507895088950989510895118951289513895148951589516895178951889519895208952189522895238952489525895268952789528895298953089531895328953389534895358953689537895388953989540895418954289543895448954589546895478954889549895508955189552895538955489555895568955789558895598956089561895628956389564895658956689567895688956989570895718957289573895748957589576895778957889579895808958189582895838958489585895868958789588895898959089591895928959389594895958959689597895988959989600896018960289603896048960589606896078960889609896108961189612896138961489615896168961789618896198962089621896228962389624896258962689627896288962989630896318963289633896348963589636896378963889639896408964189642896438964489645896468964789648896498965089651896528965389654896558965689657896588965989660896618966289663896648966589666896678966889669896708967189672896738967489675896768967789678896798968089681896828968389684896858968689687896888968989690896918969289693896948969589696896978969889699897008970189702897038970489705897068970789708897098971089711897128971389714897158971689717897188971989720897218972289723897248972589726897278972889729897308973189732897338973489735897368973789738897398974089741897428974389744897458974689747897488974989750897518975289753897548975589756897578975889759897608976189762897638976489765897668976789768897698977089771897728977389774897758977689777897788977989780897818978289783897848978589786897878978889789897908979189792897938979489795897968979789798897998980089801898028980389804898058980689807898088980989810898118981289813898148981589816898178981889819898208982189822898238982489825898268982789828898298983089831898328983389834898358983689837898388983989840898418984289843898448984589846898478984889849898508985189852898538985489855898568985789858898598986089861898628986389864898658986689867898688986989870898718987289873898748987589876898778987889879898808988189882898838988489885898868988789888898898989089891898928989389894898958989689897898988989989900899018990289903899048990589906899078990889909899108991189912899138991489915899168991789918899198992089921899228992389924899258992689927899288992989930899318993289933899348993589936899378993889939899408994189942899438994489945899468994789948899498995089951899528995389954899558995689957899588995989960899618996289963899648996589966899678996889969899708997189972899738997489975899768997789978899798998089981899828998389984899858998689987899888998989990899918999289993899948999589996899978999889999900009000190002900039000490005900069000790008900099001090011900129001390014900159001690017900189001990020900219002290023900249002590026900279002890029900309003190032900339003490035900369003790038900399004090041900429004390044900459004690047900489004990050900519005290053900549005590056900579005890059900609006190062900639006490065900669006790068900699007090071900729007390074900759007690077900789007990080900819008290083900849008590086900879008890089900909009190092900939009490095900969009790098900999010090101901029010390104901059010690107901089010990110901119011290113901149011590116901179011890119901209012190122901239012490125901269012790128901299013090131901329013390134901359013690137901389013990140901419014290143901449014590146901479014890149901509015190152901539015490155901569015790158901599016090161901629016390164901659016690167901689016990170901719017290173901749017590176901779017890179901809018190182901839018490185901869018790188901899019090191901929019390194901959019690197901989019990200902019020290203902049020590206902079020890209902109021190212902139021490215902169021790218902199022090221902229022390224902259022690227902289022990230902319023290233902349023590236902379023890239902409024190242902439024490245902469024790248902499025090251902529025390254902559025690257902589025990260902619026290263902649026590266902679026890269902709027190272902739027490275902769027790278902799028090281902829028390284902859028690287902889028990290902919029290293902949029590296902979029890299903009030190302903039030490305903069030790308903099031090311903129031390314903159031690317903189031990320903219032290323903249032590326903279032890329903309033190332903339033490335903369033790338903399034090341903429034390344903459034690347903489034990350903519035290353903549035590356903579035890359903609036190362903639036490365903669036790368903699037090371903729037390374903759037690377903789037990380903819038290383903849038590386903879038890389903909039190392903939039490395903969039790398903999040090401904029040390404904059040690407904089040990410904119041290413904149041590416904179041890419904209042190422904239042490425904269042790428904299043090431904329043390434904359043690437904389043990440904419044290443904449044590446904479044890449904509045190452904539045490455904569045790458904599046090461904629046390464904659046690467904689046990470904719047290473904749047590476904779047890479904809048190482904839048490485904869048790488904899049090491904929049390494904959049690497904989049990500905019050290503905049050590506905079050890509905109051190512905139051490515905169051790518905199052090521905229052390524905259052690527905289052990530905319053290533905349053590536905379053890539905409054190542905439054490545905469054790548905499055090551905529055390554905559055690557905589055990560905619056290563905649056590566905679056890569905709057190572905739057490575905769057790578905799058090581905829058390584905859058690587905889058990590905919059290593905949059590596905979059890599906009060190602906039060490605906069060790608906099061090611906129061390614906159061690617906189061990620906219062290623906249062590626906279062890629906309063190632906339063490635906369063790638906399064090641906429064390644906459064690647906489064990650906519065290653906549065590656906579065890659906609066190662906639066490665906669066790668906699067090671906729067390674906759067690677906789067990680906819068290683906849068590686906879068890689906909069190692906939069490695906969069790698906999070090701907029070390704907059070690707907089070990710907119071290713907149071590716907179071890719907209072190722907239072490725907269072790728907299073090731907329073390734907359073690737907389073990740907419074290743907449074590746907479074890749907509075190752907539075490755907569075790758907599076090761907629076390764907659076690767907689076990770907719077290773907749077590776907779077890779907809078190782907839078490785907869078790788907899079090791907929079390794907959079690797907989079990800908019080290803908049080590806908079080890809908109081190812908139081490815908169081790818908199082090821908229082390824908259082690827908289082990830908319083290833908349083590836908379083890839908409084190842908439084490845908469084790848908499085090851908529085390854908559085690857908589085990860908619086290863908649086590866908679086890869908709087190872908739087490875908769087790878908799088090881908829088390884908859088690887908889088990890908919089290893908949089590896908979089890899909009090190902909039090490905909069090790908909099091090911909129091390914909159091690917909189091990920909219092290923909249092590926909279092890929909309093190932909339093490935909369093790938909399094090941909429094390944909459094690947909489094990950909519095290953909549095590956909579095890959909609096190962909639096490965909669096790968909699097090971909729097390974909759097690977909789097990980909819098290983909849098590986909879098890989909909099190992909939099490995909969099790998909999100091001910029100391004910059100691007910089100991010910119101291013910149101591016910179101891019910209102191022910239102491025910269102791028910299103091031910329103391034910359103691037910389103991040910419104291043910449104591046910479104891049910509105191052910539105491055910569105791058910599106091061910629106391064910659106691067910689106991070910719107291073910749107591076910779107891079910809108191082910839108491085910869108791088910899109091091910929109391094910959109691097910989109991100911019110291103911049110591106911079110891109911109111191112911139111491115911169111791118911199112091121911229112391124911259112691127911289112991130911319113291133911349113591136911379113891139911409114191142911439114491145911469114791148911499115091151911529115391154911559115691157911589115991160911619116291163911649116591166911679116891169911709117191172911739117491175911769117791178911799118091181911829118391184911859118691187911889118991190911919119291193911949119591196911979119891199912009120191202912039120491205912069120791208912099121091211912129121391214912159121691217912189121991220912219122291223912249122591226912279122891229912309123191232912339123491235912369123791238912399124091241912429124391244912459124691247912489124991250912519125291253912549125591256912579125891259912609126191262912639126491265912669126791268912699127091271912729127391274912759127691277912789127991280912819128291283912849128591286912879128891289912909129191292912939129491295912969129791298912999130091301913029130391304913059130691307913089130991310913119131291313913149131591316913179131891319913209132191322913239132491325913269132791328913299133091331913329133391334913359133691337913389133991340913419134291343913449134591346913479134891349913509135191352913539135491355913569135791358913599136091361913629136391364913659136691367913689136991370913719137291373913749137591376913779137891379913809138191382913839138491385913869138791388913899139091391913929139391394913959139691397913989139991400914019140291403914049140591406914079140891409914109141191412914139141491415914169141791418914199142091421914229142391424914259142691427914289142991430914319143291433914349143591436914379143891439914409144191442914439144491445914469144791448914499145091451914529145391454914559145691457914589145991460914619146291463914649146591466914679146891469914709147191472914739147491475914769147791478914799148091481914829148391484914859148691487914889148991490914919149291493914949149591496914979149891499915009150191502915039150491505915069150791508915099151091511915129151391514915159151691517915189151991520915219152291523915249152591526915279152891529915309153191532915339153491535915369153791538915399154091541915429154391544915459154691547915489154991550915519155291553915549155591556915579155891559915609156191562915639156491565915669156791568915699157091571915729157391574915759157691577915789157991580915819158291583915849158591586915879158891589915909159191592915939159491595915969159791598915999160091601916029160391604916059160691607916089160991610916119161291613916149161591616916179161891619916209162191622916239162491625916269162791628916299163091631916329163391634916359163691637916389163991640916419164291643916449164591646916479164891649916509165191652916539165491655916569165791658916599166091661916629166391664916659166691667916689166991670916719167291673916749167591676916779167891679916809168191682916839168491685916869168791688916899169091691916929169391694916959169691697916989169991700917019170291703917049170591706917079170891709917109171191712917139171491715917169171791718917199172091721917229172391724917259172691727917289172991730917319173291733917349173591736917379173891739917409174191742917439174491745917469174791748917499175091751917529175391754917559175691757917589175991760917619176291763917649176591766917679176891769917709177191772917739177491775917769177791778917799178091781917829178391784917859178691787917889178991790917919179291793917949179591796917979179891799918009180191802918039180491805918069180791808918099181091811918129181391814918159181691817918189181991820918219182291823918249182591826918279182891829918309183191832918339183491835918369183791838918399184091841918429184391844918459184691847918489184991850918519185291853918549185591856918579185891859918609186191862918639186491865918669186791868918699187091871918729187391874918759187691877918789187991880918819188291883918849188591886918879188891889918909189191892918939189491895918969189791898918999190091901919029190391904919059190691907919089190991910919119191291913919149191591916919179191891919919209192191922919239192491925919269192791928919299193091931919329193391934919359193691937919389193991940919419194291943919449194591946919479194891949919509195191952919539195491955919569195791958919599196091961919629196391964919659196691967919689196991970919719197291973919749197591976919779197891979919809198191982919839198491985919869198791988919899199091991919929199391994919959199691997919989199992000920019200292003920049200592006920079200892009920109201192012920139201492015920169201792018920199202092021920229202392024920259202692027920289202992030920319203292033920349203592036920379203892039920409204192042920439204492045920469204792048920499205092051920529205392054920559205692057920589205992060920619206292063920649206592066920679206892069920709207192072920739207492075920769207792078920799208092081920829208392084920859208692087920889208992090920919209292093920949209592096920979209892099921009210192102921039210492105921069210792108921099211092111921129211392114921159211692117921189211992120921219212292123921249212592126921279212892129921309213192132921339213492135921369213792138921399214092141921429214392144921459214692147921489214992150921519215292153921549215592156921579215892159921609216192162921639216492165921669216792168921699217092171921729217392174921759217692177921789217992180921819218292183921849218592186921879218892189921909219192192921939219492195921969219792198921999220092201922029220392204922059220692207922089220992210922119221292213922149221592216922179221892219922209222192222922239222492225922269222792228922299223092231922329223392234922359223692237922389223992240922419224292243922449224592246922479224892249922509225192252922539225492255922569225792258922599226092261922629226392264922659226692267922689226992270922719227292273922749227592276922779227892279922809228192282922839228492285922869228792288922899229092291922929229392294922959229692297922989229992300923019230292303923049230592306923079230892309923109231192312923139231492315923169231792318923199232092321923229232392324923259232692327923289232992330923319233292333923349233592336923379233892339923409234192342923439234492345923469234792348923499235092351923529235392354923559235692357923589235992360923619236292363923649236592366923679236892369923709237192372923739237492375923769237792378923799238092381923829238392384923859238692387923889238992390923919239292393923949239592396923979239892399924009240192402924039240492405924069240792408924099241092411924129241392414924159241692417924189241992420924219242292423924249242592426924279242892429924309243192432924339243492435924369243792438924399244092441924429244392444924459244692447924489244992450924519245292453924549245592456924579245892459924609246192462924639246492465924669246792468924699247092471924729247392474924759247692477924789247992480924819248292483924849248592486924879248892489924909249192492924939249492495924969249792498924999250092501925029250392504925059250692507925089250992510925119251292513925149251592516925179251892519925209252192522925239252492525925269252792528925299253092531925329253392534925359253692537925389253992540925419254292543925449254592546925479254892549925509255192552925539255492555925569255792558925599256092561925629256392564925659256692567925689256992570925719257292573925749257592576925779257892579925809258192582925839258492585925869258792588925899259092591925929259392594925959259692597925989259992600926019260292603926049260592606926079260892609926109261192612926139261492615926169261792618926199262092621926229262392624926259262692627926289262992630926319263292633926349263592636926379263892639926409264192642926439264492645926469264792648926499265092651926529265392654926559265692657926589265992660926619266292663926649266592666926679266892669926709267192672926739267492675926769267792678926799268092681926829268392684926859268692687926889268992690926919269292693926949269592696926979269892699927009270192702927039270492705927069270792708927099271092711927129271392714927159271692717927189271992720927219272292723927249272592726927279272892729927309273192732927339273492735927369273792738927399274092741927429274392744927459274692747927489274992750927519275292753927549275592756927579275892759927609276192762927639276492765927669276792768927699277092771927729277392774927759277692777927789277992780927819278292783927849278592786927879278892789927909279192792927939279492795927969279792798927999280092801928029280392804928059280692807928089280992810928119281292813928149281592816928179281892819928209282192822928239282492825928269282792828928299283092831928329283392834928359283692837928389283992840928419284292843928449284592846928479284892849928509285192852928539285492855928569285792858928599286092861928629286392864928659286692867928689286992870928719287292873928749287592876928779287892879928809288192882928839288492885928869288792888928899289092891928929289392894928959289692897928989289992900929019290292903929049290592906929079290892909929109291192912929139291492915929169291792918929199292092921929229292392924929259292692927929289292992930929319293292933929349293592936929379293892939929409294192942929439294492945929469294792948929499295092951929529295392954929559295692957929589295992960929619296292963929649296592966929679296892969929709297192972929739297492975929769297792978929799298092981929829298392984929859298692987929889298992990929919299292993929949299592996929979299892999930009300193002930039300493005930069300793008930099301093011930129301393014930159301693017930189301993020930219302293023930249302593026930279302893029930309303193032930339303493035930369303793038930399304093041930429304393044930459304693047930489304993050930519305293053930549305593056930579305893059930609306193062930639306493065930669306793068930699307093071930729307393074930759307693077930789307993080930819308293083930849308593086930879308893089930909309193092930939309493095930969309793098930999310093101931029310393104931059310693107931089310993110931119311293113931149311593116931179311893119931209312193122931239312493125931269312793128931299313093131931329313393134931359313693137931389313993140931419314293143931449314593146931479314893149931509315193152931539315493155931569315793158931599316093161931629316393164931659316693167931689316993170931719317293173931749317593176931779317893179931809318193182931839318493185931869318793188931899319093191931929319393194931959319693197931989319993200932019320293203932049320593206932079320893209932109321193212932139321493215932169321793218932199322093221932229322393224932259322693227932289322993230932319323293233932349323593236932379323893239932409324193242932439324493245932469324793248932499325093251932529325393254932559325693257932589325993260932619326293263932649326593266932679326893269932709327193272932739327493275932769327793278932799328093281932829328393284932859328693287932889328993290932919329293293932949329593296932979329893299933009330193302933039330493305933069330793308933099331093311933129331393314933159331693317933189331993320933219332293323933249332593326933279332893329933309333193332933339333493335933369333793338933399334093341933429334393344933459334693347933489334993350933519335293353933549335593356933579335893359933609336193362933639336493365933669336793368933699337093371933729337393374933759337693377933789337993380933819338293383933849338593386933879338893389933909339193392933939339493395933969339793398933999340093401934029340393404934059340693407934089340993410934119341293413934149341593416934179341893419934209342193422934239342493425934269342793428934299343093431934329343393434934359343693437934389343993440934419344293443934449344593446934479344893449934509345193452934539345493455934569345793458934599346093461934629346393464934659346693467934689346993470934719347293473934749347593476934779347893479934809348193482934839348493485934869348793488934899349093491934929349393494934959349693497934989349993500935019350293503935049350593506935079350893509935109351193512935139351493515935169351793518935199352093521935229352393524935259352693527935289352993530
  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. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. -–��ú������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php½i��z¤X_½i��Æ6ä������+���src/Composer/Autoload/ClassMapGenerator.phpõ��z¤X_õ��Ó–ä5¤���������src/Composer/Cache.phpç��z¤X_ç��[27¤������%���src/Composer/Command/AboutCommand.phpØ��z¤X_Ø��ö÷;‡¤������'���src/Composer/Command/ArchiveCommand.phpä��z¤X_ä��Õ­¤������$���src/Composer/Command/BaseCommand.phpÜ ��z¤X_Ü ��gô1¤������.���src/Composer/Command/BaseDependencyCommand.phpg��z¤X_g��öNp¤������1���src/Composer/Command/CheckPlatformReqsCommand.php��z¤X_���„Ǥ������*���src/Composer/Command/ClearCacheCommand.php½��z¤X_½��°I¤������&���src/Composer/Command/ConfigCommand.phpÎQ��z¤X_ÎQ��xþÎ ¤������-���src/Composer/Command/CreateProjectCommand.phpq;��z¤X_q;��¾ô¹‡¤������'���src/Composer/Command/DependsCommand.phpø��z¤X_ø��ªeá¤������(���src/Composer/Command/DiagnoseCommand.php%P��z¤X_%P��"vé…¤������,���src/Composer/Command/DumpAutoloadCommand.phpã ��z¤X_ã ��© ]†¤������$���src/Composer/Command/ExecCommand.php ��z¤X_ ��X?!“¤������$���src/Composer/Command/FundCommand.php,
  25. ��z¤X_,
  26. ��9¤������&���src/Composer/Command/GlobalCommand.phpz ��z¤X_z ��³çå?¤������$���src/Composer/Command/HomeCommand.php��z¤X_��qLBŽ¤������$���src/Composer/Command/InitCommand.phpçU��z¤X_çU��dßG�¤������'���src/Composer/Command/InstallCommand.phpT��z¤X_T��Þùõ›¤������(���src/Composer/Command/LicensesCommand.phpò��z¤X_ò��´È¤������(���src/Composer/Command/OutdatedCommand.php ��z¤X_ ��اc¤������)���src/Composer/Command/ProhibitsCommand.php��z¤X_��_¤éS¤������&���src/Composer/Command/RemoveCommand.phpá��z¤X_á��Å1÷&¤������'���src/Composer/Command/RequireCommand.php¯)��z¤X_¯)��^ %¤������)���src/Composer/Command/RunScriptCommand.php³��z¤X_³��·ü¤������+���src/Composer/Command/ScriptAliasCommand.php¯��z¤X_¯��?=Ѥ������&���src/Composer/Command/SearchCommand.phpU ��z¤X_U ��…ߤ������*���src/Composer/Command/SelfUpdateCommand.php½C��z¤X_½C��ßðnº¤������$���src/Composer/Command/ShowCommand.phpƒ‚��z¤X_ƒ‚��O‘� ¤������&���src/Composer/Command/StatusCommand.phpP��z¤X_P��:±çú¤������(���src/Composer/Command/SuggestsCommand.php��z¤X_��ò‚Bɤ������&���src/Composer/Command/UpdateCommand.phpë#��z¤X_ë#��3<&�¤������(���src/Composer/Command/ValidateCommand.phpk��z¤X_k��y‚8K¤���������src/Composer/Composer.php ��z¤X_ ��aaN¤���������src/Composer/Config.php×$��z¤X_×$��ÝܾS¤������-���src/Composer/Config/ConfigSourceInterface.php��z¤X_��³ [/¤������(���src/Composer/Config/JsonConfigSource.php¹��z¤X_¹��”\©-¤������$���src/Composer/Console/Application.phpe8��z¤X_e8�� X‚¤������,���src/Composer/Console/HtmlOutputFormatter.php3��z¤X_3��Ú�Eu¤������-���src/Composer/DependencyResolver/Decisions.php6��z¤X_6��à• ž¤������1���src/Composer/DependencyResolver/DefaultPolicy.php��z¤X_��˜ë>#¤������/���src/Composer/DependencyResolver/GenericRule.phpµ��z¤X_µ��᫤¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��z¤X_C��´\õ*¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��z¤X_÷��ïÎà÷¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��z¤X_ý��3#†¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���z¤X_Ó���Ùâ&ä¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��z¤X_¹��&¢e
  27. ¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��z¤X_I��FûÂɤ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.php'��z¤X_'��Qúɯ¤������3���src/Composer/DependencyResolver/PolicyInterface.php­��z¤X_­��Ÿ‹R¤������(���src/Composer/DependencyResolver/Pool.php#��z¤X_#��ÿ…C�¤������+���src/Composer/DependencyResolver/Problem.phpú��z¤X_ú��]D5¤������+���src/Composer/DependencyResolver/Request.phpƒ��z¤X_ƒ��åVP„¤������(���src/Composer/DependencyResolver/Rule.php?��z¤X_?��¬‘œü¤������1���src/Composer/DependencyResolver/Rule2Literals.php��z¤X_��tZÅɤ������+���src/Composer/DependencyResolver/RuleSet.phpª
  28. ��z¤X_ª
  29. ��_΂¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php‹��z¤X_‹��‡ �¤������3���src/Composer/DependencyResolver/RuleSetIterator.php��z¤X_��›Cü$¤������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��z¤X_i��hïš,¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��z¤X_á��‰rôv¤������1���src/Composer/DependencyResolver/RuleWatchNode.php��z¤X_���Gd7¤������*���src/Composer/DependencyResolver/Solver.phpf:��z¤X_f:��Nø1´¤������6���src/Composer/DependencyResolver/SolverBugException.php™��z¤X_™��Xg6¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��z¤X_ô��×|Ŧ¤������/���src/Composer/DependencyResolver/Transaction.php×��z¤X_×��Vm쟤������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��z¤X_Æ ��G s0¤������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���z¤X_Ì���¯à¨¿¤������+���src/Composer/Downloader/DownloadManager.php`��z¤X_`��#ÏX¤������/���src/Composer/Downloader/DownloaderInterface.phpÊ��z¤X_Ê��gs!l¤������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���z¤X_Ñ���&Áœ¿¤������*���src/Composer/Downloader/FileDownloader.phpG��z¤X_G��äOФ������/���src/Composer/Downloader/FilesystemException.php
  30. ��z¤X_
  31. ��.-‹¤������,���src/Composer/Downloader/FossilDownloader.php‚ ��z¤X_‚ ��Ü�Ii¤������)���src/Composer/Downloader/GitDownloader.phpû6��z¤X_û6��Ëv0K¤������*���src/Composer/Downloader/GzipDownloader.phpó��z¤X_ó��}Úo¤������(���src/Composer/Downloader/HgDownloader.php”��z¤X_”��ßis̤������*���src/Composer/Downloader/PathDownloader.phpT��z¤X_T��®–¤������0���src/Composer/Downloader/PearPackageExtractor.phpu��z¤X_u��z„‡¤������.���src/Composer/Downloader/PerforceDownloader.phpž��z¤X_ž��Öüñ9¤������*���src/Composer/Downloader/PharDownloader.phpå���z¤X_å���ÞÉç¤������)���src/Composer/Downloader/RarDownloader.phpž��z¤X_ž��6 3U¤������)���src/Composer/Downloader/SvnDownloader.phpM��z¤X_M�� !`¤������)���src/Composer/Downloader/TarDownloader.phpã���z¤X_ã���Í’X?¤������.���src/Composer/Downloader/TransportException.php=��z¤X_=��ZÎÈÞ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���z¤X_Ô���`§ôö¤������)���src/Composer/Downloader/VcsDownloader.php¡��z¤X_¡��( à>¤������(���src/Composer/Downloader/XzDownloader.php§��z¤X_§��W$;á¤������)���src/Composer/Downloader/ZipDownloader.php���z¤X_���®Û#s¤������&���src/Composer/EventDispatcher/Event.php ��z¤X_ ��±™jï¤������0���src/Composer/EventDispatcher/EventDispatcher.php�7��z¤X_�7��—Øa¡¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���z¤X_©���h·0¤������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���z¤X_v���wZ8S¤������)���src/Composer/Exception/NoSslException.phpf���z¤X_f���ËíM�¤���������src/Composer/Factory.php_=��z¤X__=��x"Ť���������src/Composer/IO/BaseIO.php•��z¤X_•��ìÏA¤���������src/Composer/IO/BufferIO.php¾��z¤X_¾��X~d¤���������src/Composer/IO/ConsoleIO.php��z¤X_��üw·¤���������src/Composer/IO/IOInterface.phpì��z¤X_ì���Õ�¤���������src/Composer/IO/NullIO.phpÀ��z¤X_À��F`sʤ���������src/Composer/Installer.php¦£��z¤X_¦£��8Òд¤������*���src/Composer/Installer/BinaryInstaller.php
  32. ��z¤X_
  33. ��t¤{ø¤������2���src/Composer/Installer/BinaryPresenceInterface.phpË���z¤X_Ë���À5š¨¤������.���src/Composer/Installer/InstallationManager.php-��z¤X_-��¾}Œ7¤������)���src/Composer/Installer/InstallerEvent.php��z¤X_��lÔzi¤������*���src/Composer/Installer/InstallerEvents.phpÞ���z¤X_Þ���ìŸ@G¤������-���src/Composer/Installer/InstallerInterface.phpã��z¤X_ã��^ƒ“ʤ������+���src/Composer/Installer/LibraryInstaller.php%��z¤X_%�� »�̤������/���src/Composer/Installer/MetapackageInstaller.phpÊ��z¤X_Ê��Ùti·¤������(���src/Composer/Installer/NoopInstaller.php+��z¤X_+��À·M}¤������'���src/Composer/Installer/PackageEvent.phpe��z¤X_e��;° ¤������(���src/Composer/Installer/PackageEvents.php¸��z¤X_¸��dbØs¤������.���src/Composer/Installer/PearBinaryInstaller.phpø ��z¤X_ø ��*ë•k¤������(���src/Composer/Installer/PearInstaller.php¢��z¤X_¢��È‚¶Ñ¤������*���src/Composer/Installer/PluginInstaller.php¢��z¤X_¢��L´a:¤������+���src/Composer/Installer/ProjectInstaller.php��z¤X_��*0@P¤������4���src/Composer/Installer/SuggestedPackagesReporter.php:��z¤X_:��‚´UV¤���������src/Composer/Json/JsonFile.phpL��z¤X_L��rs¤������#���src/Composer/Json/JsonFormatter.phpb��z¤X_b��ÝNš¤������%���src/Composer/Json/JsonManipulator.php“4��z¤X_“4��Í®š¤������-���src/Composer/Json/JsonValidationException.php\��z¤X_\��.Xóܤ������%���src/Composer/Package/AliasPackage.phpî��z¤X_î��-�×&¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��z¤X_ ��yY+¦¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��z¤X_Þ�� ²²¹¤������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��z¤X_Ý ��í<´B¤������3���src/Composer/Package/Archiver/ArchiverInterface.php��z¤X_��ñ´> ¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��z¤X_–��y¶=Ƥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��z¤X_��‹SZ0¤������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��z¤X_r��3‘Mh¤������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��z¤X_ �� •¦S¤������.���src/Composer/Package/Archiver/PharArchiver.php?��z¤X_?��®— u¤������-���src/Composer/Package/Archiver/ZipArchiver.phpX��z¤X_X��¤k�~¤������$���src/Composer/Package/BasePackage.php ��z¤X_ ��Î&|'¤������*���src/Composer/Package/Comparer/Comparer.php½��z¤X_½��¡fK}¤������(���src/Composer/Package/CompletePackage.php¦��z¤X_¦��p[Ö¤������1���src/Composer/Package/CompletePackageInterface.php��z¤X_��Ϋ>¤������+���src/Composer/Package/Dumper/ArrayDumper.phpb ��z¤X_b ��s•°›¤���������src/Composer/Package/Link.phpˆ��z¤X_ˆ��å¶Y«¤������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��z¤X_‚��é~‹¤������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��z¤X_d��¤ôLn¤������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��z¤X_‚��ób`ý¤������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��z¤X_i��Þ”š%¤������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��z¤X_X��}`y¤������+���src/Composer/Package/Loader/ArrayLoader.php½��z¤X_½��c
  34. @�¤������7���src/Composer/Package/Loader/InvalidPackageException.phpE��z¤X_E��xb¾¤������*���src/Composer/Package/Loader/JsonLoader.phpù��z¤X_ù��!~ˆ{¤������/���src/Composer/Package/Loader/LoaderInterface.php²���z¤X_²���¦}úΤ������1���src/Composer/Package/Loader/RootPackageLoader.phpË��z¤X_Ë��4rùX¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpïA��z¤X_ïA��ÀÛe-¤���������src/Composer/Package/Locker.php="��z¤X_="��GµF+¤������ ���src/Composer/Package/Package.phpÉ��z¤X_É��cÃ�h¤������)���src/Composer/Package/PackageInterface.php\��z¤X_\��xåp¨¤������)���src/Composer/Package/RootAliasPackage.php ��z¤X_ �� _€ø¤������$���src/Composer/Package/RootPackage.php��z¤X_��ŽÎ_¤������-���src/Composer/Package/RootPackageInterface.php¹��z¤X_¹��"maV¤������/���src/Composer/Package/Version/VersionGuesser.php"��z¤X_"��XTõK¤������.���src/Composer/Package/Version/VersionParser.php¥��z¤X_¥��ô´à¤������0���src/Composer/Package/Version/VersionSelector.php¨��z¤X_¨��ý5½,¤������-���src/Composer/Plugin/Capability/Capability.phpW���z¤X_W���æ_¨1¤������2���src/Composer/Plugin/Capability/CommandProvider.php—���z¤X_—���ûOâ>¤���������src/Composer/Plugin/Capable.php���z¤X_���Æq+¤������$���src/Composer/Plugin/CommandEvent.phpâ��z¤X_â��³ÆÇW¤������$���src/Composer/Plugin/PluginEvents.phpö���z¤X_ö���á1=z¤������'���src/Composer/Plugin/PluginInterface.phpô���z¤X_ô���)'*ؤ������%���src/Composer/Plugin/PluginManager.phpª$��z¤X_ª$��m‰ƒä¤������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��z¤X_õ��:ðd¤������,���src/Composer/Plugin/PreFileDownloadEvent.php`��z¤X_`���9-Τ������4���src/Composer/Question/StrictConfirmationQuestion.php��z¤X_��'.³è¤������+���src/Composer/Repository/ArrayRepository.php¬��z¤X_¬��cð?¤������.���src/Composer/Repository/ArtifactRepository.phpí��z¤X_í��q9OS¤������*���src/Composer/Repository/BaseRepository.phpŠ��z¤X_Š��äÝ÷¤������.���src/Composer/Repository/ComposerRepository.phpLU��z¤X_LU��P] ¤������/���src/Composer/Repository/CompositeRepository.php;��z¤X_;��¤¯S¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���z¤X_…���±Ÿ_¤������0���src/Composer/Repository/FilesystemRepository.phpp��z¤X_p��#ù¤������4���src/Composer/Repository/InstalledArrayRepository.php£���z¤X_£���/ö~>¤������9���src/Composer/Repository/InstalledFilesystemRepository.php£���z¤X_£���V
  35. •_¤������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���z¤X_‡���£9p¤������6���src/Composer/Repository/InvalidRepositoryException.phpn���z¤X_n���à“똤������-���src/Composer/Repository/PackageRepository.phpj��z¤X_j��¥ôò̤������*���src/Composer/Repository/PathRepository.phpé��z¤X_é��J!šˆ¤������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��z¤X_I��c6³¤������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��z¤X_Ä��:T*ɤ������.���src/Composer/Repository/Pear/ChannelReader.phpí��z¤X_í��?ÈYT¤������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��z¤X_® ��™ÖÛú¤������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��z¤X_& ��òUb¤������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��z¤X_q��9=¤������/���src/Composer/Repository/Pear/DependencyInfo.phpq��z¤X_q��fºTò¤������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��z¤X_…��÷$Li¤������,���src/Composer/Repository/Pear/PackageInfo.php°��z¤X_°��Ÿ ¸ ¤������,���src/Composer/Repository/Pear/ReleaseInfo.php’��z¤X_’��o“ŠÃ¤������*���src/Composer/Repository/PearRepository.phpª��z¤X_ª��)Ÿƒ}¤������.���src/Composer/Repository/PlatformRepository.php;!��z¤X_;!��äö9¤������-���src/Composer/Repository/RepositoryFactory.phpb��z¤X_b��’{²ý¤������/���src/Composer/Repository/RepositoryInterface.phpÛ��z¤X_Û��’âÁ¤������-���src/Composer/Repository/RepositoryManager.phpM ��z¤X_M ��<(;Œ¤������7���src/Composer/Repository/RepositorySecurityException.phpo���z¤X_o���pÕ«ª¤������/���src/Composer/Repository/Vcs/BitbucketDriver.php‚ ��z¤X_‚ ��n¢v>¤������,���src/Composer/Repository/Vcs/FossilDriver.php³��z¤X_³��ÐCk¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��z¤X_ë��œ´½X¤������)���src/Composer/Repository/Vcs/GitDriver.php:��z¤X_:��ÀÕ.p¤������,���src/Composer/Repository/Vcs/GitHubDriver.php�4��z¤X_�4��ê,ˆä¤������,���src/Composer/Repository/Vcs/GitLabDriver.phpŽ*��z¤X_Ž*��½¹²Ð¤������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��z¤X_å��@)‰L¤������(���src/Composer/Repository/Vcs/HgDriver.phpB��z¤X_B��»ƒî¤������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��z¤X_ù ��&½tÙ¤������)���src/Composer/Repository/Vcs/SvnDriver.php¤��z¤X_¤�� ¤������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��z¤X_æ
  37. ��eׯ-¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��z¤X_÷��ÇX[‰¤������)���src/Composer/Repository/VcsRepository.php˜-��z¤X_˜-��ø2²¤������1���src/Composer/Repository/VersionCacheInterface.php”���z¤X_”���A?Rï¤������3���src/Composer/Repository/WritableArrayRepository.php��z¤X_��¾G*¤������7���src/Composer/Repository/WritableRepositoryInterface.php‰��z¤X_‰��‘/sï¤������$���src/Composer/Script/CommandEvent.phpW���z¤X_W���£VZt¤���������src/Composer/Script/Event.phpº��z¤X_º��ò�»¤¤������$���src/Composer/Script/PackageEvent.phpœ���z¤X_œ���§ÿÉ ¤������$���src/Composer/Script/ScriptEvents.phpP��z¤X_P��‡�¶¤������ ���src/Composer/SelfUpdate/Keys.php���z¤X_��� îÊN¤������$���src/Composer/SelfUpdate/Versions.phpH��z¤X_H��c lB¤������ ���src/Composer/Util/AuthHelper.phpË��z¤X_Ë��>zx–¤���������src/Composer/Util/Bitbucket.php*��z¤X_*��,Lšk¤������$���src/Composer/Util/ComposerMirror.php±��z¤X_±��­½øؤ������%���src/Composer/Util/ConfigValidator.php÷��z¤X_÷��v•Í¤������"���src/Composer/Util/ErrorHandler.php»��z¤X_»��O›rk¤������ ���src/Composer/Util/Filesystem.phpm/��z¤X_m/��Çë¡ú¤���������src/Composer/Util/Git.phpä0��z¤X_ä0��'‰ïç¤���������src/Composer/Util/GitHub.php| ��z¤X_| ��`0tü¤���������src/Composer/Util/GitLab.phpù��z¤X_ù��ž7«£¤���������src/Composer/Util/Hg.php¾��z¤X_¾��LÓ �¤���������src/Composer/Util/IniHelper.phph��z¤X_h��;FP¤������$���src/Composer/Util/NoProxyPattern.php|��z¤X_|��¸|ää¤������#���src/Composer/Util/PackageSorter.phpÞ��z¤X_Þ��ê×ìY¤���������src/Composer/Util/Perforce.php¸2��z¤X_¸2��Ás&}¤���������src/Composer/Util/Platform.phpü��z¤X_ü��s­fç¤������%���src/Composer/Util/ProcessExecutor.php$ ��z¤X_$ ��¨Nó¤������&���src/Composer/Util/RemoteFilesystem.phpFr��z¤X_Fr��¡Ò¤���������src/Composer/Util/Silencer.phpé��z¤X_é��“Vjf¤������!���src/Composer/Util/SpdxLicense.php��z¤X_��¾7
  38. ñ¤������*���src/Composer/Util/StreamContextFactory.php��z¤X_��CÉ…ù¤���������src/Composer/Util/Svn.php,��z¤X_,��Ì žÄ¤���������src/Composer/Util/TlsHelper.phpL
  39. ��z¤X_L
  40. ��" i¤���������src/Composer/Util/Url.php£��z¤X_£��3œÉܤ���������src/Composer/Util/Zip.php³��z¤X_³��äŠÎª¤���������src/Composer/XdebugHandler.phpð��z¤X_ð��zÓf~¤���������src/bootstrap.php¹��z¤X_¹��I}œ¤������%���src/Composer/Autoload/ClassLoader.php¡4��z¤X_¡4��Þs…|¤������#���res/composer-repository-schema.jsonð��z¤X_ð���GÐà¤���������res/composer-schema.jsonM���z¤X_M���_Τ������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¸ ��z¤X_¸ ��Â4DC¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsoná£��z¤X_á£��Ú¼Ó¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��z¤X_�$��•�¥v¤������&���vendor/symfony/console/Application.php=X��z¤X_=X��� S’¤������*���vendor/symfony/console/Command/Command.phpî"��z¤X_î"��x°jÕ¤������.���vendor/symfony/console/Command/HelpCommand.phpØ��z¤X_Ø��¦Ú-:¤������.���vendor/symfony/console/Command/ListCommand.phpZ��z¤X_Z��»w`¤������(���vendor/symfony/console/ConsoleEvents.phpé���z¤X_é���RÛÔe¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��z¤X_Ð��™Ž5°¤������0���vendor/symfony/console/Descriptor/Descriptor.php���z¤X_���¿N•¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���z¤X_ü���±Qµ¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��z¤X_Ü ��*û�ɤ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��z¤X_¶��·Ô;ݤ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��z¤X_¼��òç$¤������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��z¤X_��b{<¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��z¤X_°��!�Ȥ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��z¤X_Å��ÒxÛ\¤������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��z¤X_��á2é¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��z¤X_z��³,îL¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��z¤X_Ô��È÷ L¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���z¤X_f���¡ABª¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���z¤X_¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���z¤X_¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���z¤X_’���ÍO\e¤������5���vendor/symfony/console/Exception/RuntimeException.php–���z¤X_–���Ùí,6¤������4���vendor/symfony/console/Formatter/OutputFormatter.php6��z¤X_6��?=¨¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��z¤X_Œ��òññÀ¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��z¤X_F��𦴤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��z¤X_„��÷½G¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��z¤X_@��G¨ýU¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��z¤X_y��Ì8ÆФ������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��z¤X_w��|¦C¤������.���vendor/symfony/console/Helper/DialogHelper.php��z¤X_��¹ÜÃ_¤������1���vendor/symfony/console/Helper/FormatterHelper.phpd��z¤X_d��§×,¸¤������(���vendor/symfony/console/Helper/Helper.php«��z¤X_«��!�§—¤������1���vendor/symfony/console/Helper/HelperInterface.phpå���z¤X_å���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpÊ��z¤X_Ê��áÏW"¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��z¤X_c��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��z¤X_Ó ��©w‚R¤������-���vendor/symfony/console/Helper/ProgressBar.phpl%��z¤X_l%�� díÛ¤������0���vendor/symfony/console/Helper/ProgressHelper.php]��z¤X_]��ù»‰X¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��z¤X_N��ÿ§³l¤������0���vendor/symfony/console/Helper/QuestionHelper.phpl��z¤X_l��Ntó¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  41. ��z¤X_–
  42. ��- ؤ������'���vendor/symfony/console/Helper/Table.phpÄ*��z¤X_Ä*��¾™ØT¤������+���vendor/symfony/console/Helper/TableCell.php���z¤X_���åV^¤������-���vendor/symfony/console/Helper/TableHelper.php ��z¤X_ ��›uô™¤������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���z¤X_Ê���az¤������,���vendor/symfony/console/Helper/TableStyle.php
  43. ��z¤X_
  44. ��_ÍI"¤������*���vendor/symfony/console/Input/ArgvInput.php��z¤X_��×ö†›¤������+���vendor/symfony/console/Input/ArrayInput.php) ��z¤X_) ��¥ÑC¤������&���vendor/symfony/console/Input/Input.php£ ��z¤X_£ ��f¡?¤������.���vendor/symfony/console/Input/InputArgument.php��z¤X_��D £¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���z¤X_˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php†��z¤X_†��¤U)¤¤������/���vendor/symfony/console/Input/InputInterface.php£��z¤X_£��ÆBŒ'¤������,���vendor/symfony/console/Input/InputOption.php ��z¤X_ ��\¢Ü=¤������,���vendor/symfony/console/Input/StringInput.phpš��z¤X_š��žµ è¤���������vendor/symfony/console/LICENSE)��z¤X_)��NUN½¤������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��z¤X_0 ��…� ¸¤������0���vendor/symfony/console/Output/BufferedOutput.php_��z¤X__��‹ >P¤������/���vendor/symfony/console/Output/ConsoleOutput.php±��z¤X_±��nì!f¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���z¤X_à���‡†Æʤ������,���vendor/symfony/console/Output/NullOutput.phpÏ��z¤X_Ï��®˜‹Z¤������(���vendor/symfony/console/Output/Output.php˜ ��z¤X_˜ ��0p¤������1���vendor/symfony/console/Output/OutputInterface.php��z¤X_���ì&¤������.���vendor/symfony/console/Output/StreamOutput.php���z¤X_���Ä’Oç¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  45. ��z¤X_x
  46. ��W€!¤������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��z¤X_è��/Ô�¤������,���vendor/symfony/console/Question/Question.phpÎ ��z¤X_Î ��lF¤������ ���vendor/symfony/console/Shell.phpæ��z¤X_æ��¼XÒA¤������,���vendor/symfony/console/Style/OutputStyle.php\��z¤X_\��wפ¤������/���vendor/symfony/console/Style/StyleInterface.phpÏ��z¤X_Ï��&nÅѤ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��z¤X_ä��­å (¤������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��z¤X_Ï��sž9i¤������/���vendor/symfony/console/Tester/CommandTester.phpª��z¤X_ª��¬K z¤������(���vendor/symfony/debug/BufferingLogger.phpt��z¤X_t��=�hܤ���������vendor/symfony/debug/Debug.php,��z¤X_,��Ë~Ž.¤������)���vendor/symfony/debug/DebugClassLoader.phpµ��z¤X_µ��1rEÓ¤������%���vendor/symfony/debug/ErrorHandler.phpH��z¤X_H��¹:D#¤������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��z¤X_–��i‰æô¤������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��z¤X_˜��-
  47. d2¤������1���vendor/symfony/debug/Exception/DummyException.php��z¤X_��®+Ãê¤������6���vendor/symfony/debug/Exception/FatalErrorException.php��z¤X_��™Ä¤������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��z¤X_W��?àèK¤������3���vendor/symfony/debug/Exception/FlattenException.php¼��z¤X_¼�� פ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���z¤X_~���ë¨oâ¤������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��z¤X_š���ñJÀ¤������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��z¤X_˜��nöêؤ������)���vendor/symfony/debug/ExceptionHandler.php)3��z¤X_)3���h5=¤������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��z¤X_A��Ϥ¹l¤������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��z¤X_��ĹBV¤������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��z¤X_x��~ò"¤������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��z¤X_O���ž¦*¤���������vendor/symfony/debug/LICENSE)��z¤X_)��NUN½¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���z¤X_i���$ ÿ›¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��z¤X_¼��pí\¶¤������3���vendor/symfony/filesystem/Exception/IOException.php‡��z¤X_‡��€ü#Ѥ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���z¤X_¦���jÙwM¤������(���vendor/symfony/filesystem/Filesystem.phpc4��z¤X_c4��‹×@þ¤������!���vendor/symfony/filesystem/LICENSE)��z¤X_)��NUN½¤������)���vendor/symfony/filesystem/LockHandler.phpö��z¤X_ö��ŸZµ1¤������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��z¤X_\ ��hˆB¤������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���z¤X_���HC€/¤������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��z¤X_›��Mþ¤������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��z¤X_3��75$·¤������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��z¤X_��Ÿ`]¤������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��z¤X_ô��Þdè;¤������/���vendor/symfony/finder/Comparator/Comparator.php���z¤X_���¾üœµ¤������3���vendor/symfony/finder/Comparator/DateComparator.php#��z¤X_#��°Τ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��z¤X_|��ITÇͤ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���z¤X_„���½¾sœ¤������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��z¤X_¬��wR¤������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���z¤X_„���Gz-¤������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��z¤X_)��x§e¤������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��z¤X_º��˜þ˜¤������/���vendor/symfony/finder/Expression/Expression.php��z¤X_��i¥:Ť������)���vendor/symfony/finder/Expression/Glob.phpf��z¤X_f��DÞcj¤������*���vendor/symfony/finder/Expression/Regex.php��z¤X_��ü(ÃϤ������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��z¤X_Í��\p4†¤������ ���vendor/symfony/finder/Finder.phpc.��z¤X_c.��:ˆ5g¤���������vendor/symfony/finder/Glob.phpL��z¤X_L��jÍ9פ������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��z¤X_]��ÎoÅƤ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��z¤X_x��ôP¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��z¤X_î��üÍ�q¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��z¤X_í��nõH¤������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��z¤X_#��G?T½¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��z¤X_Z��(&ø¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��z¤X_5��ší¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��z¤X_r��tu¤������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��z¤X_Ã��š+µÞ¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��z¤X_-��ºÎÒ_¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��z¤X_Ð��‚c¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��z¤X_ ��ë]í»¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��z¤X_e��Ÿ’áé¤������3���vendor/symfony/finder/Iterator/SortableIterator.php+��z¤X_+��õÝË ¤���������vendor/symfony/finder/LICENSE)��z¤X_)��NUN½¤������'���vendor/symfony/finder/Shell/Command.php> ��z¤X_> ��_~u ¤������%���vendor/symfony/finder/Shell/Shell.phpr��z¤X_r��þpN¤������%���vendor/symfony/finder/SplFileInfo.php��z¤X_��þ�íù¤������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��z¤X_H ��³�Õݤ������%���vendor/symfony/polyfill-ctype/LICENSE)��z¤X_)��´`e0¤������+���vendor/symfony/polyfill-ctype/bootstrap.phpä��z¤X_ä��—o£¤������(���vendor/symfony/polyfill-mbstring/LICENSE)��z¤X_)��“\ª¤������-���vendor/symfony/polyfill-mbstring/Mbstring.php€G��z¤X_€G��ɖз¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷T��z¤X_÷T��ß2ª?¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��z¤X_ã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpîU��z¤X_îU��`þ8Q¤������.���vendor/symfony/polyfill-mbstring/bootstrap.php)��z¤X_)��p¼B¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���z¤X_f���]ö>T¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���z¤X_¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���z¤X_”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��z¤X_x��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��z¤X_��﫤������5���vendor/symfony/process/Exception/RuntimeException.php˜���z¤X_˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php���z¤X_���ûus€¤���������vendor/symfony/process/LICENSE)��z¤X_)��NUN½¤������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��z¤X_Ï��Î%h¤������%���vendor/symfony/process/PhpProcess.phpü��z¤X_ü��‡jûü¤������.���vendor/symfony/process/Pipes/AbstractPipes.php½��z¤X_½��憤������/���vendor/symfony/process/Pipes/PipesInterface.phpD��z¤X_D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��z¤X_>��ª•ir¤������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��z¤X_p ��âU~ɤ������"���vendor/symfony/process/Process.php·R��z¤X_·R��Š`Õ¤������)���vendor/symfony/process/ProcessBuilder.phpâ
  48. ��z¤X_â
  49. ��†M¶¤������'���vendor/symfony/process/ProcessUtils.phpQ��z¤X_Q��b-$m¤���������vendor/seld/jsonlint/LICENSE"��z¤X_"��aƒsy¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.phpk��z¤X_k��Zù¶Ã¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.phpU2��z¤X_U2��ús.Ƥ������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php#��z¤X_#��Úá@,¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php%��z¤X_%��`a„|¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���z¤X_>���ÿqŸŸ¤������(���vendor/justinrainbow/json-schema/LICENSE ��z¤X_ ��ºç©¤������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��z¤X_ñ��fC¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��z¤X_¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  50. ��z¤X_�
  51. ��ÍèÓ¯¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��z¤X_§ ��›Vؤ������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��z¤X_¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��z¤X_]��VŽU<¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��z¤X_ã ��á0;¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��z¤X_…��“TœÚ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��z¤X_‡ ��ï›(¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��z¤X_Ã��©Å¼x¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��z¤X_0 ��×j´˜¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��z¤X_��¥wš‡¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��z¤X_a�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��z¤X_—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��z¤X_‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��z¤X_&��4˜©T¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpS"��z¤X_S"��¼¾õ:¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��z¤X_è��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���z¤X_I���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���z¤X_•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���z¤X_l���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���z¤X_l���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���z¤X_u���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���z¤X_w���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��z¤X_Þ��\¸
  52. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���z¤X_o���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���z¤X_…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���z¤X_€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���z¤X_j���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���z¤X_f���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��z¤X_þ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��z¤X_ ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��z¤X_œ ��åfO¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��z¤X_��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���z¤X_á���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��z¤X_¥��Ô§Lb¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��z¤X_%��5" ¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��z¤X_,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���z¤X_®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��z¤X_ ��£Ÿ)à¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��z¤X_F��¨IaD¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���z¤X_ƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���z¤X_…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��z¤X_v��õÍg¤������%���vendor/composer/spdx-licenses/LICENSE��z¤X_��Bhí¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��z¤X_H��͉T¤���������vendor/composer/semver/LICENSE��z¤X_��Bhí¤������)���vendor/composer/semver/src/Comparator.php��z¤X_��wlƒï¤������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��z¤X_î��Õ­w-¤������4���vendor/composer/semver/src/Constraint/Constraint.php’ ��z¤X_’ ��I&â¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���z¤X_ß���0C,‡¤������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpä��z¤X_ä��ïõ‚³¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.php,��z¤X_,��0°=¤������%���vendor/composer/semver/src/Semver.php‚��z¤X_‚��?nݤ������,���vendor/composer/semver/src/VersionParser.phpÔ-��z¤X_Ô-��”ÜÚ¦¤������!���vendor/composer/ca-bundle/LICENSE��z¤X_��*!^`¤������*���vendor/composer/ca-bundle/src/CaBundle.phpR��z¤X_R��!Ã%�¤������&���vendor/composer/xdebug-handler/LICENSE)��z¤X_)��#Ô;^¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��z¤X_´��*D’�¤������.���vendor/composer/xdebug-handler/src/Process.phpp ��z¤X_p ��i,i‘¤������-���vendor/composer/xdebug-handler/src/Status.php
  53. ��z¤X_
  54. ��$Ÿv-¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.php#��z¤X_#��ñ†B¤���������vendor/psr/log/LICENSE=��z¤X_=��p±ŽO¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��z¤X_;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���z¤X_`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���z¤X_û���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���z¤X_|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���z¤X_§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��z¤X_È��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��z¤X_k��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.php ���z¤X_ ���ÆDi¯¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���z¤X_p���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��z¤X_ ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��z¤X_<��þ(åI¤���������vendor/autoload.php‚���z¤X_‚���Þ@0¤������'���vendor/composer/autoload_namespaces.phpd���z¤X_d���Z¡¦H¤������!���vendor/composer/autoload_psr4.php÷��z¤X_÷��Å*š¤������%���vendor/composer/autoload_classmap.phpd���z¤X_d���Z¡¦H¤������"���vendor/composer/autoload_files.php��z¤X_��¥� ®¤������!���vendor/composer/autoload_real.phpL��z¤X_L�� G¦¤������#���vendor/composer/autoload_static.php§
  55. ��z¤X_§
  56. ��h…;¤���������vendor/composer/ClassLoader.php¶��z¤X_¶��ôJ1¤������(���vendor/composer/ca-bundle/res/cacert.pemÜc�z¤X_Üc�9ç‹ù¤������ ���bin/composerÊ��z¤X_Ê���4K¤���������LICENSE.��z¤X_.�� Õ¤������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. use Composer\Util\PackageSorter;
  68. class AutoloadGenerator
  69. {
  70. private $eventDispatcher;
  71. private $io;
  72. private $devMode = false;
  73. private $classMapAuthoritative = false;
  74. private $apcu = false;
  75. private $runScripts = false;
  76. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  77. {
  78. $this->eventDispatcher = $eventDispatcher;
  79. $this->io = $io;
  80. }
  81. public function setDevMode($devMode = true)
  82. {
  83. $this->devMode = (bool) $devMode;
  84. }
  85. public function setClassMapAuthoritative($classMapAuthoritative)
  86. {
  87. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  88. }
  89. public function setApcu($apcu)
  90. {
  91. $this->apcu = (bool) $apcu;
  92. }
  93. public function setRunScripts($runScripts = true)
  94. {
  95. $this->runScripts = (bool) $runScripts;
  96. }
  97. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
  98. {
  99. if ($this->classMapAuthoritative) {
  100. $scanPsrPackages = true;
  101. }
  102. if ($this->runScripts) {
  103. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  104. 'optimize' => (bool) $scanPsrPackages,
  105. ));
  106. }
  107. $filesystem = new Filesystem();
  108. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  109. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  110. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  111. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  112. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  113. $targetDir = $vendorPath.'/'.$targetDir;
  114. $filesystem->ensureDirectoryExists($targetDir);
  115. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  116. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  117. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  118. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  119. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  120. $namespacesFile = <<<EOF
  121. <?php
  122. // autoload_namespaces.php @generated by Composer
  123. \$vendorDir = $vendorPathCode52;
  124. \$baseDir = $appBaseDirCode;
  125. return array(
  126. EOF;
  127. $psr4File = <<<EOF
  128. <?php
  129. // autoload_psr4.php @generated by Composer
  130. \$vendorDir = $vendorPathCode52;
  131. \$baseDir = $appBaseDirCode;
  132. return array(
  133. EOF;
  134. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  135. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  136. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  137. $exportedPaths = array();
  138. foreach ($paths as $path) {
  139. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  140. }
  141. $exportedPrefix = var_export($namespace, true);
  142. $namespacesFile .= " $exportedPrefix => ";
  143. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  144. }
  145. $namespacesFile .= ");\n";
  146. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  147. $exportedPaths = array();
  148. foreach ($paths as $path) {
  149. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  150. }
  151. $exportedPrefix = var_export($namespace, true);
  152. $psr4File .= " $exportedPrefix => ";
  153. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  154. }
  155. $psr4File .= ");\n";
  156. $classmapFile = <<<EOF
  157. <?php
  158. // autoload_classmap.php @generated by Composer
  159. \$vendorDir = $vendorPathCode52;
  160. \$baseDir = $appBaseDirCode;
  161. return array(
  162. EOF;
  163. $targetDirLoader = null;
  164. $mainAutoload = $mainPackage->getAutoload();
  165. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  166. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  167. $prefixes = implode(', ', array_map(function ($prefix) {
  168. return var_export($prefix, true);
  169. }, array_keys($mainAutoload['psr-0'])));
  170. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  171. $targetDirLoader = <<<EOF
  172. public static function autoload(\$class)
  173. {
  174. \$dir = $baseDirFromTargetDirCode . '/';
  175. \$prefixes = array($prefixes);
  176. foreach (\$prefixes as \$prefix) {
  177. if (0 !== strpos(\$class, \$prefix)) {
  178. continue;
  179. }
  180. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  181. if (!\$path = stream_resolve_include_path(\$path)) {
  182. return false;
  183. }
  184. require \$path;
  185. return true;
  186. }
  187. }
  188. EOF;
  189. }
  190. $excluded = null;
  191. if (!empty($autoloads['exclude-from-classmap'])) {
  192. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  193. }
  194. $classMap = array();
  195. $ambiguousClasses = array();
  196. $scannedFiles = array();
  197. foreach ($autoloads['classmap'] as $dir) {
  198. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
  199. }
  200. if ($scanPsrPackages) {
  201. $namespacesToScan = array();
  202. foreach (array('psr-4', 'psr-0') as $psrType) {
  203. foreach ($autoloads[$psrType] as $namespace => $paths) {
  204. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  205. }
  206. }
  207. krsort($namespacesToScan);
  208. foreach ($namespacesToScan as $namespace => $groups) {
  209. foreach ($groups as $group) {
  210. foreach ($group['paths'] as $dir) {
  211. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  212. if (!is_dir($dir)) {
  213. continue;
  214. }
  215. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
  216. }
  217. }
  218. }
  219. }
  220. foreach ($ambiguousClasses as $className => $ambigiousPaths) {
  221. $cleanPath = str_replace(array('$vendorDir . \'', '$baseDir . \'', "',\n"), array($vendorPath, $basePath, ''), $classMap[$className]);
  222. $this->io->writeError(
  223. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  224. ' was found '. (count($ambigiousPaths) + 1) .'x: in "'.$cleanPath.'" and "'. implode('", "', $ambigiousPaths) .'", the first will be used.</warning>'
  225. );
  226. }
  227. ksort($classMap);
  228. foreach ($classMap as $class => $code) {
  229. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  230. }
  231. $classmapFile .= ");\n";
  232. if (!$suffix) {
  233. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  234. $content = file_get_contents($vendorPath.'/autoload.php');
  235. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  236. $suffix = $match[1];
  237. }
  238. }
  239. if (!$suffix) {
  240. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  241. }
  242. }
  243. $this->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  244. $this->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  245. $this->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  246. $includePathFilePath = $targetDir.'/include_paths.php';
  247. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. $this->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  249. } elseif (file_exists($includePathFilePath)) {
  250. unlink($includePathFilePath);
  251. }
  252. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  253. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  254. $this->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  255. } elseif (file_exists($includeFilesFilePath)) {
  256. unlink($includeFilesFilePath);
  257. }
  258. $this->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  259. $this->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  260. $this->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  261. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  262. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  263. if ($this->runScripts) {
  264. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  265. 'optimize' => (bool) $scanPsrPackages,
  266. ));
  267. }
  268. return count($classMap);
  269. }
  270. private function filePutContentsIfModified($path, $content)
  271. {
  272. $currentContent = @file_get_contents($path);
  273. if (!$currentContent || ($currentContent != $content)) {
  274. return file_put_contents($path, $content);
  275. }
  276. return 0;
  277. }
  278. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
  279. {
  280. foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
  281. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  282. if (!isset($classMap[$class])) {
  283. $classMap[$class] = $pathCode;
  284. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  285. $ambiguousClasses[$class][] = $path;
  286. }
  287. }
  288. return $classMap;
  289. }
  290. private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
  291. {
  292. return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
  293. }
  294. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  295. {
  296. $packageMap = array(array($mainPackage, ''));
  297. foreach ($packages as $package) {
  298. if ($package instanceof AliasPackage) {
  299. continue;
  300. }
  301. $this->validatePackage($package);
  302. $packageMap[] = array(
  303. $package,
  304. $installationManager->getInstallPath($package),
  305. );
  306. }
  307. return $packageMap;
  308. }
  309. protected function validatePackage(PackageInterface $package)
  310. {
  311. $autoload = $package->getAutoload();
  312. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  313. $name = $package->getName();
  314. $package->getTargetDir();
  315. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  316. }
  317. if (!empty($autoload['psr-4'])) {
  318. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  319. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  320. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  321. }
  322. }
  323. }
  324. }
  325. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  326. {
  327. $mainPackageMap = array_shift($packageMap);
  328. if ($filterOutRequireDevPackages) {
  329. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  330. }
  331. $sortedPackageMap = $this->sortPackageMap($packageMap);
  332. $sortedPackageMap[] = $mainPackageMap;
  333. array_unshift($packageMap, $mainPackageMap);
  334. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  335. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  336. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  337. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  338. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  339. krsort($psr0);
  340. krsort($psr4);
  341. return array(
  342. 'psr-0' => $psr0,
  343. 'psr-4' => $psr4,
  344. 'classmap' => $classmap,
  345. 'files' => $files,
  346. 'exclude-from-classmap' => $exclude,
  347. );
  348. }
  349. public function createLoader(array $autoloads)
  350. {
  351. $loader = new ClassLoader();
  352. if (isset($autoloads['psr-0'])) {
  353. foreach ($autoloads['psr-0'] as $namespace => $path) {
  354. $loader->add($namespace, $path);
  355. }
  356. }
  357. if (isset($autoloads['psr-4'])) {
  358. foreach ($autoloads['psr-4'] as $namespace => $path) {
  359. $loader->addPsr4($namespace, $path);
  360. }
  361. }
  362. if (isset($autoloads['classmap'])) {
  363. $excluded = null;
  364. if (!empty($autoloads['exclude-from-classmap'])) {
  365. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  366. }
  367. $scannedFiles = array();
  368. foreach ($autoloads['classmap'] as $dir) {
  369. try {
  370. $loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
  371. } catch (\RuntimeException $e) {
  372. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  373. }
  374. }
  375. }
  376. return $loader;
  377. }
  378. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  379. {
  380. $includePaths = array();
  381. foreach ($packageMap as $item) {
  382. list($package, $installPath) = $item;
  383. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  384. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  385. }
  386. foreach ($package->getIncludePaths() as $includePath) {
  387. $includePath = trim($includePath, '/');
  388. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  389. }
  390. }
  391. if (!$includePaths) {
  392. return;
  393. }
  394. $includePathsCode = '';
  395. foreach ($includePaths as $path) {
  396. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  397. }
  398. return <<<EOF
  399. <?php
  400. // include_paths.php @generated by Composer
  401. \$vendorDir = $vendorPathCode;
  402. \$baseDir = $appBaseDirCode;
  403. return array(
  404. $includePathsCode);
  405. EOF;
  406. }
  407. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  408. {
  409. $filesCode = '';
  410. foreach ($files as $fileIdentifier => $functionFile) {
  411. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  412. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  413. }
  414. if (!$filesCode) {
  415. return false;
  416. }
  417. return <<<EOF
  418. <?php
  419. // autoload_files.php @generated by Composer
  420. \$vendorDir = $vendorPathCode;
  421. \$baseDir = $appBaseDirCode;
  422. return array(
  423. $filesCode);
  424. EOF;
  425. }
  426. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  427. {
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $path = $basePath . '/' . $path;
  430. }
  431. $path = $filesystem->normalizePath($path);
  432. $baseDir = '';
  433. if (strpos($path.'/', $vendorPath.'/') === 0) {
  434. $path = substr($path, strlen($vendorPath));
  435. $baseDir = '$vendorDir';
  436. if ($path !== false) {
  437. $baseDir .= " . ";
  438. }
  439. } else {
  440. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  441. if (!$filesystem->isAbsolutePath($path)) {
  442. $baseDir = '$baseDir . ';
  443. $path = '/' . $path;
  444. }
  445. }
  446. if (strpos($path, '.phar') !== false) {
  447. $baseDir = "'phar://' . " . $baseDir;
  448. }
  449. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  450. }
  451. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  452. {
  453. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  454. if ("'" === $lastChar || '"' === $lastChar) {
  455. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  456. } else {
  457. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  458. }
  459. return <<<AUTOLOAD
  460. <?php
  461. // autoload.php @generated by Composer
  462. require_once $vendorPathToTargetDirCode;
  463. return ComposerAutoloaderInit$suffix::getLoader();
  464. AUTOLOAD;
  465. }
  466. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  467. {
  468. $file = <<<HEADER
  469. <?php
  470. // autoload_real.php @generated by Composer
  471. class ComposerAutoloaderInit$suffix
  472. {
  473. private static \$loader;
  474. public static function loadClassLoader(\$class)
  475. {
  476. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  477. require __DIR__ . '/ClassLoader.php';
  478. }
  479. }
  480. /**
  481. * @return \Composer\Autoload\ClassLoader
  482. */
  483. public static function getLoader()
  484. {
  485. if (null !== self::\$loader) {
  486. return self::\$loader;
  487. }
  488. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  489. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  490. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  491. HEADER;
  492. if ($useIncludePath) {
  493. $file .= <<<'INCLUDE_PATH'
  494. $includePaths = require __DIR__ . '/include_paths.php';
  495. $includePaths[] = get_include_path();
  496. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  497. INCLUDE_PATH;
  498. }
  499. $file .= <<<STATIC_INIT
  500. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  501. if (\$useStaticLoader) {
  502. require_once __DIR__ . '/autoload_static.php';
  503. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  504. } else {
  505. STATIC_INIT;
  506. if (!$this->classMapAuthoritative) {
  507. $file .= <<<'PSR04'
  508. $map = require __DIR__ . '/autoload_namespaces.php';
  509. foreach ($map as $namespace => $path) {
  510. $loader->set($namespace, $path);
  511. }
  512. $map = require __DIR__ . '/autoload_psr4.php';
  513. foreach ($map as $namespace => $path) {
  514. $loader->setPsr4($namespace, $path);
  515. }
  516. PSR04;
  517. }
  518. if ($useClassMap) {
  519. $file .= <<<'CLASSMAP'
  520. $classMap = require __DIR__ . '/autoload_classmap.php';
  521. if ($classMap) {
  522. $loader->addClassMap($classMap);
  523. }
  524. CLASSMAP;
  525. }
  526. $file .= " }\n\n";
  527. if ($this->classMapAuthoritative) {
  528. $file .= <<<'CLASSMAPAUTHORITATIVE'
  529. $loader->setClassMapAuthoritative(true);
  530. CLASSMAPAUTHORITATIVE;
  531. }
  532. if ($this->apcu) {
  533. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  534. $file .= <<<APCU
  535. \$loader->setApcuPrefix('$apcuPrefix');
  536. APCU;
  537. }
  538. if ($useGlobalIncludePath) {
  539. $file .= <<<'INCLUDEPATH'
  540. $loader->setUseIncludePath(true);
  541. INCLUDEPATH;
  542. }
  543. if ($targetDirLoader) {
  544. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  545. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  546. REGISTER_TARGET_DIR_AUTOLOAD;
  547. }
  548. $file .= <<<REGISTER_LOADER
  549. \$loader->register($prependAutoloader);
  550. REGISTER_LOADER;
  551. if ($useIncludeFiles) {
  552. $file .= <<<INCLUDE_FILES
  553. if (\$useStaticLoader) {
  554. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  555. } else {
  556. \$includeFiles = require __DIR__ . '/autoload_files.php';
  557. }
  558. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  559. composerRequire$suffix(\$fileIdentifier, \$file);
  560. }
  561. INCLUDE_FILES;
  562. }
  563. $file .= <<<METHOD_FOOTER
  564. return \$loader;
  565. }
  566. METHOD_FOOTER;
  567. $file .= $targetDirLoader;
  568. if ($useIncludeFiles) {
  569. return $file . <<<FOOTER
  570. }
  571. function composerRequire$suffix(\$fileIdentifier, \$file)
  572. {
  573. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  574. require \$file;
  575. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  576. }
  577. }
  578. FOOTER;
  579. }
  580. return $file . <<<FOOTER
  581. }
  582. FOOTER;
  583. }
  584. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  585. {
  586. $staticPhpVersion = 50600;
  587. $file = <<<HEADER
  588. <?php
  589. // autoload_static.php @generated by Composer
  590. namespace Composer\Autoload;
  591. class ComposerStaticInit$suffix
  592. {
  593. HEADER;
  594. $loader = new ClassLoader();
  595. $map = require $targetDir . '/autoload_namespaces.php';
  596. foreach ($map as $namespace => $path) {
  597. $loader->set($namespace, $path);
  598. }
  599. $map = require $targetDir . '/autoload_psr4.php';
  600. foreach ($map as $namespace => $path) {
  601. $loader->setPsr4($namespace, $path);
  602. }
  603. $classMap = require $targetDir . '/autoload_classmap.php';
  604. if ($classMap) {
  605. $loader->addClassMap($classMap);
  606. }
  607. $filesystem = new Filesystem();
  608. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  609. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  610. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  611. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  612. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  613. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  614. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  615. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  616. $initializer = '';
  617. $prefix = "\0Composer\Autoload\ClassLoader\0";
  618. $prefixLen = strlen($prefix);
  619. if (file_exists($targetDir . '/autoload_files.php')) {
  620. $maps = array('files' => require $targetDir . '/autoload_files.php');
  621. } else {
  622. $maps = array();
  623. }
  624. foreach ((array) $loader as $prop => $value) {
  625. if ($value && 0 === strpos($prop, $prefix)) {
  626. $maps[substr($prop, $prefixLen)] = $value;
  627. }
  628. }
  629. foreach ($maps as $prop => $value) {
  630. if (count($value) > 32767) {
  631. $staticPhpVersion = 70000;
  632. }
  633. $value = strtr(
  634. var_export($value, true),
  635. array(
  636. $absoluteVendorPathCode => $vendorPathCode,
  637. $absoluteVendorPharPathCode => $vendorPharPathCode,
  638. $absoluteAppBaseDirCode => $appBaseDirCode,
  639. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  640. )
  641. );
  642. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  643. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  644. if ('files' !== $prop) {
  645. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  646. }
  647. }
  648. return $file . <<<INITIALIZER
  649. public static function getInitializer(ClassLoader \$loader)
  650. {
  651. return \Closure::bind(function () use (\$loader) {
  652. $initializer
  653. }, null, ClassLoader::class);
  654. }
  655. }
  656. INITIALIZER;
  657. }
  658. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  659. {
  660. $autoloads = array();
  661. foreach ($packageMap as $item) {
  662. list($package, $installPath) = $item;
  663. $autoload = $package->getAutoload();
  664. if ($this->devMode && $package === $mainPackage) {
  665. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  666. }
  667. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  668. continue;
  669. }
  670. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  671. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  672. }
  673. foreach ($autoload[$type] as $namespace => $paths) {
  674. foreach ((array) $paths as $path) {
  675. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  676. if ($package === $mainPackage) {
  677. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  678. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  679. } else {
  680. $path = $package->getTargetDir() . '/' . $path;
  681. }
  682. }
  683. if ($type === 'exclude-from-classmap') {
  684. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  685. $path = str_replace('\\*\\*', '.+?', $path);
  686. $path = str_replace('\\*', '[^/]+?', $path);
  687. $updir = null;
  688. $path = preg_replace_callback(
  689. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  690. function ($matches) use (&$updir) {
  691. if (isset($matches[1])) {
  692. $updir = str_replace('\\.', '.', $matches[1]);
  693. }
  694. return '';
  695. },
  696. $path
  697. );
  698. if (empty($installPath)) {
  699. $installPath = strtr(getcwd(), '\\', '/');
  700. }
  701. $resolvedPath = realpath($installPath . '/' . $updir);
  702. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  703. continue;
  704. }
  705. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  706. if ($type === 'files') {
  707. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  708. continue;
  709. } elseif ($type === 'classmap') {
  710. $autoloads[] = $relativePath;
  711. continue;
  712. }
  713. $autoloads[$namespace][] = $relativePath;
  714. }
  715. }
  716. }
  717. return $autoloads;
  718. }
  719. protected function getFileIdentifier(PackageInterface $package, $path)
  720. {
  721. return md5($package->getName() . ':' . $path);
  722. }
  723. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  724. {
  725. $packages = array();
  726. $include = array();
  727. $replacedBy = array();
  728. foreach ($packageMap as $item) {
  729. $package = $item[0];
  730. $name = $package->getName();
  731. $packages[$name] = $package;
  732. foreach ($package->getReplaces() as $replace) {
  733. $replacedBy[$replace->getTarget()] = $name;
  734. }
  735. }
  736. $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy) {
  737. foreach ($package->getRequires() as $link) {
  738. $target = $link->getTarget();
  739. if (isset($replacedBy[$target])) {
  740. $target = $replacedBy[$target];
  741. }
  742. if (!isset($include[$target])) {
  743. $include[$target] = true;
  744. if (isset($packages[$target])) {
  745. $add($packages[$target]);
  746. }
  747. }
  748. }
  749. };
  750. $add($mainPackage);
  751. return array_filter(
  752. $packageMap,
  753. function ($item) use ($include) {
  754. $package = $item[0];
  755. foreach ($package->getNames() as $name) {
  756. if (isset($include[$name])) {
  757. return true;
  758. }
  759. }
  760. return false;
  761. }
  762. );
  763. }
  764. protected function sortPackageMap(array $packageMap)
  765. {
  766. $packages = array();
  767. $paths = array();
  768. foreach ($packageMap as $item) {
  769. list($package, $path) = $item;
  770. $name = $package->getName();
  771. $packages[$name] = $package;
  772. $paths[$name] = $path;
  773. }
  774. $sortedPackages = PackageSorter::sortPackages($packages);
  775. $sortedPackageMap = array();
  776. foreach ($sortedPackages as $package) {
  777. $name = $package->getName();
  778. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  779. }
  780. return $sortedPackageMap;
  781. }
  782. protected function safeCopy($source, $target)
  783. {
  784. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  785. $source = fopen($source, 'r');
  786. $target = fopen($target, 'w+');
  787. stream_copy_to_stream($source, $target);
  788. fclose($source);
  789. fclose($target);
  790. }
  791. }
  792. private function filesAreEqual($a, $b)
  793. {
  794. if (filesize($a) !== filesize($b)) {
  795. return false;
  796. }
  797. $ah = fopen($a, 'rb');
  798. $bh = fopen($b, 'rb');
  799. $result = true;
  800. while (!feof($ah)) {
  801. if (fread($ah, 8192) != fread($bh, 8192)) {
  802. $result = false;
  803. break;
  804. }
  805. }
  806. fclose($ah);
  807. fclose($bh);
  808. return $result;
  809. }
  810. }
  811. <?php
  812. namespace Composer\Autoload;
  813. use Symfony\Component\Finder\Finder;
  814. use Composer\IO\IOInterface;
  815. use Composer\Util\Filesystem;
  816. class ClassMapGenerator
  817. {
  818. public static function dump($dirs, $file)
  819. {
  820. $maps = array();
  821. foreach ($dirs as $dir) {
  822. $maps = array_merge($maps, static::createMap($dir));
  823. }
  824. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  825. }
  826. public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
  827. {
  828. if (is_string($path)) {
  829. $basePath = $path;
  830. if (is_file($path)) {
  831. $path = array(new \SplFileInfo($path));
  832. } elseif (is_dir($path)) {
  833. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  834. } else {
  835. throw new \RuntimeException(
  836. 'Could not scan for classes inside "'.$path.
  837. '" which does not appear to be a file nor a folder'
  838. );
  839. }
  840. } elseif (null !== $autoloadType) {
  841. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  842. }
  843. $map = array();
  844. $filesystem = new Filesystem();
  845. $cwd = realpath(getcwd());
  846. foreach ($path as $file) {
  847. $filePath = $file->getPathname();
  848. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  849. continue;
  850. }
  851. if (!$filesystem->isAbsolutePath($filePath)) {
  852. $filePath = $cwd . '/' . $filePath;
  853. $filePath = $filesystem->normalizePath($filePath);
  854. } else {
  855. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  856. }
  857. $realPath = realpath($filePath);
  858. if (isset($scannedFiles[$realPath])) {
  859. continue;
  860. }
  861. if ($excluded && preg_match($excluded, strtr($realPath, '\\', '/'))) {
  862. continue;
  863. }
  864. if ($excluded && preg_match($excluded, strtr($filePath, '\\', '/'))) {
  865. continue;
  866. }
  867. $classes = self::findClasses($filePath);
  868. if (null !== $autoloadType) {
  869. list($classes, $validClasses) = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  870. if ($validClasses) {
  871. $scannedFiles[$realPath] = true;
  872. }
  873. } else {
  874. $scannedFiles[$realPath] = true;
  875. }
  876. foreach ($classes as $class) {
  877. if ( null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  878. continue;
  879. }
  880. if (!isset($map[$class])) {
  881. $map[$class] = $filePath;
  882. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  883. $io->writeError(
  884. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  885. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  886. );
  887. }
  888. }
  889. }
  890. return $map;
  891. }
  892. private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
  893. {
  894. $validClasses = array();
  895. $rejectedClasses = array();
  896. $realSubPath = substr($filePath, strlen($basePath) + 1);
  897. $realSubPath = substr($realSubPath, 0, strrpos($realSubPath, '.'));
  898. foreach ($classes as $class) {
  899. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  900. continue;
  901. }
  902. if ('psr-0' === $namespaceType) {
  903. $namespaceLength = strrpos($class, '\\');
  904. if (false !== $namespaceLength) {
  905. $namespace = substr($class, 0, $namespaceLength + 1);
  906. $className = substr($class, $namespaceLength + 1);
  907. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  908. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  909. }
  910. else {
  911. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  912. }
  913. } elseif ('psr-4' === $namespaceType) {
  914. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  915. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  916. } else {
  917. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  918. }
  919. if ($subPath === $realSubPath) {
  920. $validClasses[] = $class;
  921. } else {
  922. $rejectedClasses[] = $class;
  923. }
  924. }
  925. if (empty($validClasses)) {
  926. foreach ($rejectedClasses as $class) {
  927. trigger_error(
  928. "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v2.0.",
  929. E_USER_DEPRECATED
  930. );
  931. }
  932. }
  933. return array($classes, $validClasses);
  934. }
  935. private static function findClasses($path)
  936. {
  937. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  938. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  939. $extraTypes .= '|enum';
  940. }
  941. $contents = @php_strip_whitespace($path);
  942. if (!$contents) {
  943. if (!file_exists($path)) {
  944. $message = 'File at "%s" does not exist, check your classmap definitions';
  945. } elseif (!is_readable($path)) {
  946. $message = 'File at "%s" is not readable, check its permissions';
  947. } elseif ('' === trim(file_get_contents($path))) {
  948. return array();
  949. } else {
  950. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  951. }
  952. $error = error_get_last();
  953. if (isset($error['message'])) {
  954. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  955. }
  956. throw new \RuntimeException(sprintf($message, $path));
  957. }
  958. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  959. return array();
  960. }
  961. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  962. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  963. if (substr($contents, 0, 2) !== '<?') {
  964. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  965. if ($replacements === 0) {
  966. return array();
  967. }
  968. }
  969. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  970. $pos = strrpos($contents, '?>');
  971. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  972. $contents = substr($contents, 0, $pos);
  973. }
  974. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  975. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  976. }
  977. preg_match_all('{
  978. (?:
  979. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  980. | \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*+ [\{;]
  981. )
  982. }ix', $contents, $matches);
  983. $classes = array();
  984. $namespace = '';
  985. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  986. if (!empty($matches['ns'][$i])) {
  987. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  988. } else {
  989. $name = $matches['name'][$i];
  990. if ($name === 'extends' || $name === 'implements') {
  991. continue;
  992. }
  993. if ($name[0] === ':') {
  994. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  995. } elseif ($matches['type'][$i] === 'enum') {
  996. $name = rtrim($name, ':');
  997. }
  998. $classes[] = ltrim($namespace . $name, '\\');
  999. }
  1000. }
  1001. return $classes;
  1002. }
  1003. }
  1004. <?php
  1005. namespace Composer;
  1006. use Composer\IO\IOInterface;
  1007. use Composer\Util\Filesystem;
  1008. use Composer\Util\Silencer;
  1009. use Symfony\Component\Finder\Finder;
  1010. class Cache
  1011. {
  1012. private static $cacheCollected = false;
  1013. private $io;
  1014. private $root;
  1015. private $enabled = true;
  1016. private $allowList;
  1017. private $filesystem;
  1018. public function __construct(IOInterface $io, $cacheDir, $allowList = 'a-z0-9.', Filesystem $filesystem = null)
  1019. {
  1020. $this->io = $io;
  1021. $this->root = rtrim($cacheDir, '/\\') . '/';
  1022. $this->allowList = $allowList;
  1023. $this->filesystem = $filesystem ?: new Filesystem();
  1024. if (!self::isUsable($cacheDir)) {
  1025. $this->enabled = false;
  1026. return;
  1027. }
  1028. if (
  1029. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1030. || !is_writable($this->root)
  1031. ) {
  1032. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1033. $this->enabled = false;
  1034. }
  1035. }
  1036. public static function isUsable($path)
  1037. {
  1038. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1039. }
  1040. public function isEnabled()
  1041. {
  1042. return $this->enabled;
  1043. }
  1044. public function getRoot()
  1045. {
  1046. return $this->root;
  1047. }
  1048. public function read($file)
  1049. {
  1050. if ($this->enabled) {
  1051. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1052. if (file_exists($this->root . $file)) {
  1053. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1054. return file_get_contents($this->root . $file);
  1055. }
  1056. }
  1057. return false;
  1058. }
  1059. public function write($file, $contents)
  1060. {
  1061. if ($this->enabled) {
  1062. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1063. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1064. try {
  1065. return file_put_contents($this->root . $file, $contents);
  1066. } catch (\ErrorException $e) {
  1067. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1068. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1069. unlink($this->root . $file);
  1070. $message = sprintf(
  1071. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1072. $this->root . $file,
  1073. $m[1],
  1074. $m[2],
  1075. @disk_free_space($this->root . dirname($file))
  1076. );
  1077. $this->io->writeError($message);
  1078. return false;
  1079. }
  1080. throw $e;
  1081. }
  1082. }
  1083. return false;
  1084. }
  1085. public function copyFrom($file, $source)
  1086. {
  1087. if ($this->enabled) {
  1088. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1089. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1090. if (!file_exists($source)) {
  1091. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1092. } elseif ($this->io->isDebug()) {
  1093. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1094. }
  1095. return copy($source, $this->root . $file);
  1096. }
  1097. return false;
  1098. }
  1099. public function copyTo($file, $target)
  1100. {
  1101. if ($this->enabled) {
  1102. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1103. if (file_exists($this->root . $file)) {
  1104. try {
  1105. touch($this->root . $file, filemtime($this->root . $file), time());
  1106. } catch (\ErrorException $e) {
  1107. Silencer::call('touch', $this->root . $file);
  1108. }
  1109. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1110. return copy($this->root . $file, $target);
  1111. }
  1112. }
  1113. return false;
  1114. }
  1115. public function gcIsNecessary()
  1116. {
  1117. return (!self::$cacheCollected && !mt_rand(0, 50));
  1118. }
  1119. public function remove($file)
  1120. {
  1121. if ($this->enabled) {
  1122. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1123. if (file_exists($this->root . $file)) {
  1124. return $this->filesystem->unlink($this->root . $file);
  1125. }
  1126. }
  1127. return false;
  1128. }
  1129. public function clear()
  1130. {
  1131. if ($this->enabled) {
  1132. $this->filesystem->emptyDirectory($this->root);
  1133. return true;
  1134. }
  1135. return false;
  1136. }
  1137. public function gc($ttl, $maxSize)
  1138. {
  1139. if ($this->enabled) {
  1140. $expire = new \DateTime();
  1141. $expire->modify('-'.$ttl.' seconds');
  1142. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1143. foreach ($finder as $file) {
  1144. $this->filesystem->unlink($file->getPathname());
  1145. }
  1146. $totalSize = $this->filesystem->size($this->root);
  1147. if ($totalSize > $maxSize) {
  1148. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1149. while ($totalSize > $maxSize && $iterator->valid()) {
  1150. $filepath = $iterator->current()->getPathname();
  1151. $totalSize -= $this->filesystem->size($filepath);
  1152. $this->filesystem->unlink($filepath);
  1153. $iterator->next();
  1154. }
  1155. }
  1156. self::$cacheCollected = true;
  1157. return true;
  1158. }
  1159. return false;
  1160. }
  1161. public function sha1($file)
  1162. {
  1163. if ($this->enabled) {
  1164. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1165. if (file_exists($this->root . $file)) {
  1166. return sha1_file($this->root . $file);
  1167. }
  1168. }
  1169. return false;
  1170. }
  1171. public function sha256($file)
  1172. {
  1173. if ($this->enabled) {
  1174. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1175. if (file_exists($this->root . $file)) {
  1176. return hash_file('sha256', $this->root . $file);
  1177. }
  1178. }
  1179. return false;
  1180. }
  1181. protected function getFinder()
  1182. {
  1183. return Finder::create()->in($this->root)->files();
  1184. }
  1185. }
  1186. <?php
  1187. namespace Composer\Command;
  1188. use Symfony\Component\Console\Input\InputInterface;
  1189. use Symfony\Component\Console\Output\OutputInterface;
  1190. class AboutCommand extends BaseCommand
  1191. {
  1192. protected function configure()
  1193. {
  1194. $this
  1195. ->setName('about')
  1196. ->setDescription('Shows the short information about Composer.')
  1197. ->setHelp(
  1198. <<<EOT
  1199. <info>php composer.phar about</info>
  1200. EOT
  1201. )
  1202. ;
  1203. }
  1204. protected function execute(InputInterface $input, OutputInterface $output)
  1205. {
  1206. $this->getIO()->write(
  1207. <<<EOT
  1208. <info>Composer - Dependency Manager for PHP</info>
  1209. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1210. See https://getcomposer.org/ for more information.</comment>
  1211. EOT
  1212. );
  1213. return 0;
  1214. }
  1215. }
  1216. <?php
  1217. namespace Composer\Command;
  1218. use Composer\Factory;
  1219. use Composer\IO\IOInterface;
  1220. use Composer\Config;
  1221. use Composer\Composer;
  1222. use Composer\Repository\CompositeRepository;
  1223. use Composer\Repository\RepositoryFactory;
  1224. use Composer\Script\ScriptEvents;
  1225. use Composer\Plugin\CommandEvent;
  1226. use Composer\Plugin\PluginEvents;
  1227. use Composer\Util\Filesystem;
  1228. use Symfony\Component\Console\Input\InputArgument;
  1229. use Symfony\Component\Console\Input\InputInterface;
  1230. use Symfony\Component\Console\Input\InputOption;
  1231. use Symfony\Component\Console\Output\OutputInterface;
  1232. class ArchiveCommand extends BaseCommand
  1233. {
  1234. protected function configure()
  1235. {
  1236. $this
  1237. ->setName('archive')
  1238. ->setDescription('Creates an archive of this composer package.')
  1239. ->setDefinition(array(
  1240. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1241. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1242. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1243. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1244. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1245. .' Note that the format will be appended.'),
  1246. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1247. ))
  1248. ->setHelp(
  1249. <<<EOT
  1250. The <info>archive</info> command creates an archive of the specified format
  1251. containing the files and directories of the Composer project or the specified
  1252. package in the specified version and writes it to the specified directory.
  1253. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1254. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1255. EOT
  1256. )
  1257. ;
  1258. }
  1259. protected function execute(InputInterface $input, OutputInterface $output)
  1260. {
  1261. $composer = $this->getComposer(false);
  1262. $config = null;
  1263. if ($composer) {
  1264. $config = $composer->getConfig();
  1265. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1266. $eventDispatcher = $composer->getEventDispatcher();
  1267. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1268. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1269. }
  1270. if (!$config) {
  1271. $config = Factory::createConfig();
  1272. }
  1273. if (null === $input->getOption('format')) {
  1274. $input->setOption('format', $config->get('archive-format'));
  1275. }
  1276. if (null === $input->getOption('dir')) {
  1277. $input->setOption('dir', $config->get('archive-dir'));
  1278. }
  1279. $returnCode = $this->archive(
  1280. $this->getIO(),
  1281. $config,
  1282. $input->getArgument('package'),
  1283. $input->getArgument('version'),
  1284. $input->getOption('format'),
  1285. $input->getOption('dir'),
  1286. $input->getOption('file'),
  1287. $input->getOption('ignore-filters'),
  1288. $composer
  1289. );
  1290. if (0 === $returnCode && $composer) {
  1291. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1292. }
  1293. return $returnCode;
  1294. }
  1295. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1296. {
  1297. if ($composer) {
  1298. $archiveManager = $composer->getArchiveManager();
  1299. } else {
  1300. $factory = new Factory;
  1301. $downloadManager = $factory->createDownloadManager($io, $config);
  1302. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1303. }
  1304. if ($packageName) {
  1305. $package = $this->selectPackage($io, $packageName, $version);
  1306. if (!$package) {
  1307. return 1;
  1308. }
  1309. } else {
  1310. $package = $this->getComposer()->getPackage();
  1311. }
  1312. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1313. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1314. $fs = new Filesystem;
  1315. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1316. $io->writeError('Created: ', false);
  1317. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1318. return 0;
  1319. }
  1320. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1321. {
  1322. $io->writeError('<info>Searching for the specified package.</info>');
  1323. if ($composer = $this->getComposer(false)) {
  1324. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1325. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1326. } else {
  1327. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1328. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1329. $repo = new CompositeRepository($defaultRepos);
  1330. }
  1331. $packages = $repo->findPackages($packageName, $version);
  1332. if (count($packages) > 1) {
  1333. $package = reset($packages);
  1334. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1335. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1336. return $p->getPrettyString();
  1337. }, $packages)).'.');
  1338. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1339. } elseif ($packages) {
  1340. $package = reset($packages);
  1341. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1342. } else {
  1343. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1344. return false;
  1345. }
  1346. return $package;
  1347. }
  1348. }
  1349. <?php
  1350. namespace Composer\Command;
  1351. use Composer\Composer;
  1352. use Composer\Config;
  1353. use Composer\Console\Application;
  1354. use Composer\Factory;
  1355. use Composer\IO\IOInterface;
  1356. use Composer\IO\NullIO;
  1357. use Composer\Plugin\PreCommandRunEvent;
  1358. use Composer\Plugin\PluginEvents;
  1359. use Symfony\Component\Console\Input\InputInterface;
  1360. use Symfony\Component\Console\Output\OutputInterface;
  1361. use Symfony\Component\Console\Command\Command;
  1362. abstract class BaseCommand extends Command
  1363. {
  1364. private $composer;
  1365. private $io;
  1366. public function getComposer($required = true, $disablePlugins = null)
  1367. {
  1368. if (null === $this->composer) {
  1369. $application = $this->getApplication();
  1370. if ($application instanceof Application) {
  1371. $this->composer = $application->getComposer($required, $disablePlugins);
  1372. } elseif ($required) {
  1373. throw new \RuntimeException(
  1374. 'Could not create a Composer\Composer instance, you must inject '.
  1375. 'one if this command is not used with a Composer\Console\Application instance'
  1376. );
  1377. }
  1378. }
  1379. return $this->composer;
  1380. }
  1381. public function setComposer(Composer $composer)
  1382. {
  1383. $this->composer = $composer;
  1384. }
  1385. public function resetComposer()
  1386. {
  1387. $this->composer = null;
  1388. $this->getApplication()->resetComposer();
  1389. }
  1390. public function isProxyCommand()
  1391. {
  1392. return false;
  1393. }
  1394. public function getIO()
  1395. {
  1396. if (null === $this->io) {
  1397. $application = $this->getApplication();
  1398. if ($application instanceof Application) {
  1399. $this->io = $application->getIO();
  1400. } else {
  1401. $this->io = new NullIO();
  1402. }
  1403. }
  1404. return $this->io;
  1405. }
  1406. public function setIO(IOInterface $io)
  1407. {
  1408. $this->io = $io;
  1409. }
  1410. protected function initialize(InputInterface $input, OutputInterface $output)
  1411. {
  1412. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1413. $composer = $this->getComposer(false, $disablePlugins);
  1414. if (null === $composer) {
  1415. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1416. }
  1417. if ($composer) {
  1418. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1419. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1420. }
  1421. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1422. $input->setOption('no-progress', true);
  1423. }
  1424. parent::initialize($input, $output);
  1425. }
  1426. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1427. {
  1428. $preferSource = false;
  1429. $preferDist = false;
  1430. switch ($config->get('preferred-install')) {
  1431. case 'source':
  1432. $preferSource = true;
  1433. break;
  1434. case 'dist':
  1435. $preferDist = true;
  1436. break;
  1437. case 'auto':
  1438. default:
  1439. break;
  1440. }
  1441. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1442. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1443. $preferDist = $input->getOption('prefer-dist');
  1444. }
  1445. return array($preferSource, $preferDist);
  1446. }
  1447. }
  1448. <?php
  1449. namespace Composer\Command;
  1450. use Composer\DependencyResolver\Pool;
  1451. use Composer\Package\Link;
  1452. use Composer\Package\PackageInterface;
  1453. use Composer\Repository\ArrayRepository;
  1454. use Composer\Repository\CompositeRepository;
  1455. use Composer\Repository\PlatformRepository;
  1456. use Composer\Repository\RepositoryFactory;
  1457. use Composer\Plugin\CommandEvent;
  1458. use Composer\Plugin\PluginEvents;
  1459. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1460. use Composer\Package\Version\VersionParser;
  1461. use Symfony\Component\Console\Helper\Table;
  1462. use Symfony\Component\Console\Input\InputArgument;
  1463. use Symfony\Component\Console\Input\InputInterface;
  1464. use Symfony\Component\Console\Input\InputOption;
  1465. use Symfony\Component\Console\Output\OutputInterface;
  1466. class BaseDependencyCommand extends BaseCommand
  1467. {
  1468. const ARGUMENT_PACKAGE = 'package';
  1469. const ARGUMENT_CONSTRAINT = 'constraint';
  1470. const OPTION_RECURSIVE = 'recursive';
  1471. const OPTION_TREE = 'tree';
  1472. protected $colors;
  1473. protected function configure()
  1474. {
  1475. $this->setDefinition(array(
  1476. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1477. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1478. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1479. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1480. ));
  1481. }
  1482. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1483. {
  1484. $composer = $this->getComposer();
  1485. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1486. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1487. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1488. $repository = new CompositeRepository(array(
  1489. new ArrayRepository(array($composer->getPackage())),
  1490. $composer->getRepositoryManager()->getLocalRepository(),
  1491. new PlatformRepository(array(), $platformOverrides),
  1492. ));
  1493. $pool = new Pool();
  1494. $pool->addRepository($repository);
  1495. list($needle, $textConstraint) = array_pad(
  1496. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1497. 2,
  1498. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1499. );
  1500. $packages = $pool->whatProvides(strtolower($needle));
  1501. if (empty($packages)) {
  1502. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1503. }
  1504. if (!$repository->findPackage($needle, $textConstraint)) {
  1505. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1506. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1507. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1508. }
  1509. }
  1510. $needles = array($needle);
  1511. if ($inverted) {
  1512. foreach ($packages as $package) {
  1513. $needles = array_merge($needles, array_map(function (Link $link) {
  1514. return $link->getTarget();
  1515. }, $package->getReplaces()));
  1516. }
  1517. }
  1518. if ('*' !== $textConstraint) {
  1519. $versionParser = new VersionParser();
  1520. $constraint = $versionParser->parseConstraints($textConstraint);
  1521. } else {
  1522. $constraint = null;
  1523. }
  1524. $renderTree = $input->getOption(self::OPTION_TREE);
  1525. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1526. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1527. if (empty($results)) {
  1528. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1529. $this->getIO()->writeError(sprintf(
  1530. '<info>There is no installed package depending on "%s"%s</info>',
  1531. $needle,
  1532. $extra
  1533. ));
  1534. } elseif ($renderTree) {
  1535. $this->initStyles($output);
  1536. $root = $packages[0];
  1537. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1538. $this->printTree($results);
  1539. } else {
  1540. $this->printTable($output, $results);
  1541. }
  1542. return 0;
  1543. }
  1544. protected function printTable(OutputInterface $output, $results)
  1545. {
  1546. $table = array();
  1547. $doubles = array();
  1548. do {
  1549. $queue = array();
  1550. $rows = array();
  1551. foreach ($results as $result) {
  1552. list($package, $link, $children) = $result;
  1553. $unique = (string) $link;
  1554. if (isset($doubles[$unique])) {
  1555. continue;
  1556. }
  1557. $doubles[$unique] = true;
  1558. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1559. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1560. if ($children) {
  1561. $queue = array_merge($queue, $children);
  1562. }
  1563. }
  1564. $results = $queue;
  1565. $table = array_merge($rows, $table);
  1566. } while (!empty($results));
  1567. $renderer = new Table($output);
  1568. $renderer->setStyle('compact');
  1569. $rendererStyle = $renderer->getStyle();
  1570. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1571. $rendererStyle->setVerticalBorderChars('');
  1572. } else {
  1573. $rendererStyle->setVerticalBorderChar('');
  1574. }
  1575. $rendererStyle->setCellRowContentFormat('%s ');
  1576. $renderer->setRows($table)->render();
  1577. }
  1578. protected function initStyles(OutputInterface $output)
  1579. {
  1580. $this->colors = array(
  1581. 'green',
  1582. 'yellow',
  1583. 'cyan',
  1584. 'magenta',
  1585. 'blue',
  1586. );
  1587. foreach ($this->colors as $color) {
  1588. $style = new OutputFormatterStyle($color);
  1589. $output->getFormatter()->setStyle($color, $style);
  1590. }
  1591. }
  1592. protected function printTree($results, $prefix = '', $level = 1)
  1593. {
  1594. $count = count($results);
  1595. $idx = 0;
  1596. foreach ($results as $result) {
  1597. list($package, $link, $children) = $result;
  1598. $color = $this->colors[$level % count($this->colors)];
  1599. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1600. $isLast = (++$idx == $count);
  1601. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1602. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1603. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1604. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1605. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1606. if ($children) {
  1607. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1608. }
  1609. }
  1610. }
  1611. private function writeTreeLine($line)
  1612. {
  1613. $io = $this->getIO();
  1614. if (!$io->isDecorated()) {
  1615. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1616. }
  1617. $io->write($line);
  1618. }
  1619. }
  1620. <?php
  1621. namespace Composer\Command;
  1622. use Composer\Package\Link;
  1623. use Composer\Package\PackageInterface;
  1624. use Composer\Semver\Constraint\Constraint;
  1625. use Symfony\Component\Console\Helper\Table;
  1626. use Symfony\Component\Console\Input\InputInterface;
  1627. use Symfony\Component\Console\Input\InputOption;
  1628. use Symfony\Component\Console\Output\OutputInterface;
  1629. use Composer\Repository\PlatformRepository;
  1630. class CheckPlatformReqsCommand extends BaseCommand
  1631. {
  1632. protected function configure()
  1633. {
  1634. $this->setName('check-platform-reqs')
  1635. ->setDescription('Check that platform requirements are satisfied.')
  1636. ->setDefinition(array(
  1637. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1638. ))
  1639. ->setHelp(
  1640. <<<EOT
  1641. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1642. 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.
  1643. <info>php composer.phar check-platform-reqs</info>
  1644. EOT
  1645. );
  1646. }
  1647. protected function execute(InputInterface $input, OutputInterface $output)
  1648. {
  1649. $composer = $this->getComposer();
  1650. $requires = $composer->getPackage()->getRequires();
  1651. if ($input->getOption('no-dev')) {
  1652. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1653. } else {
  1654. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1655. if (!$dependencies) {
  1656. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1657. }
  1658. $requires += $composer->getPackage()->getDevRequires();
  1659. }
  1660. foreach ($requires as $require => $link) {
  1661. $requires[$require] = array($link);
  1662. }
  1663. foreach ($dependencies as $package) {
  1664. foreach ($package->getRequires() as $require => $link) {
  1665. $requires[$require][] = $link;
  1666. }
  1667. }
  1668. ksort($requires);
  1669. $platformRepo = new PlatformRepository(array(), array());
  1670. $currentPlatformPackages = $platformRepo->getPackages();
  1671. $currentPlatformPackageMap = array();
  1672. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1673. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1674. }
  1675. $results = array();
  1676. $exitCode = 0;
  1677. foreach ($requires as $require => $links) {
  1678. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1679. if (isset($currentPlatformPackageMap[$require])) {
  1680. $pass = true;
  1681. $version = $currentPlatformPackageMap[$require]->getVersion();
  1682. foreach ($links as $link) {
  1683. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1684. $results[] = array(
  1685. $currentPlatformPackageMap[$require]->getPrettyName(),
  1686. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1687. $link,
  1688. '<error>failed</error>',
  1689. );
  1690. $pass = false;
  1691. $exitCode = max($exitCode, 1);
  1692. }
  1693. }
  1694. if ($pass) {
  1695. $results[] = array(
  1696. $currentPlatformPackageMap[$require]->getPrettyName(),
  1697. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1698. null,
  1699. '<info>success</info>',
  1700. );
  1701. }
  1702. } else {
  1703. $results[] = array(
  1704. $require,
  1705. 'n/a',
  1706. $links[0],
  1707. '<error>missing</error>',
  1708. );
  1709. $exitCode = max($exitCode, 2);
  1710. }
  1711. }
  1712. }
  1713. $this->printTable($output, $results);
  1714. return $exitCode;
  1715. }
  1716. protected function printTable(OutputInterface $output, $results)
  1717. {
  1718. $table = array();
  1719. $rows = array();
  1720. foreach ($results as $result) {
  1721. list($platformPackage, $version, $link, $status) = $result;
  1722. $rows[] = array(
  1723. $platformPackage,
  1724. $version,
  1725. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1726. $status,
  1727. );
  1728. }
  1729. $table = array_merge($rows, $table);
  1730. $renderer = new Table($output);
  1731. $renderer->setStyle('compact');
  1732. $rendererStyle = $renderer->getStyle();
  1733. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1734. $rendererStyle->setVerticalBorderChars('');
  1735. } else {
  1736. $rendererStyle->setVerticalBorderChar('');
  1737. }
  1738. $rendererStyle->setCellRowContentFormat('%s ');
  1739. $renderer->setRows($table)->render();
  1740. }
  1741. }
  1742. <?php
  1743. namespace Composer\Command;
  1744. use Composer\Cache;
  1745. use Composer\Factory;
  1746. use Symfony\Component\Console\Input\InputInterface;
  1747. use Symfony\Component\Console\Output\OutputInterface;
  1748. class ClearCacheCommand extends BaseCommand
  1749. {
  1750. protected function configure()
  1751. {
  1752. $this
  1753. ->setName('clear-cache')
  1754. ->setAliases(array('clearcache', 'cc'))
  1755. ->setDescription('Clears composer\'s internal package cache.')
  1756. ->setHelp(
  1757. <<<EOT
  1758. The <info>clear-cache</info> deletes all cached packages from composer's
  1759. cache directory.
  1760. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  1761. EOT
  1762. )
  1763. ;
  1764. }
  1765. protected function execute(InputInterface $input, OutputInterface $output)
  1766. {
  1767. $config = Factory::createConfig();
  1768. $io = $this->getIO();
  1769. $cachePaths = array(
  1770. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1771. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1772. 'cache-files-dir' => $config->get('cache-files-dir'),
  1773. 'cache-dir' => $config->get('cache-dir'),
  1774. );
  1775. foreach ($cachePaths as $key => $cachePath) {
  1776. $cachePath = realpath($cachePath);
  1777. if (!$cachePath) {
  1778. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1779. continue;
  1780. }
  1781. $cache = new Cache($io, $cachePath);
  1782. if (!$cache->isEnabled()) {
  1783. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1784. continue;
  1785. }
  1786. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1787. $cache->clear();
  1788. }
  1789. $io->writeError('<info>All caches cleared.</info>');
  1790. return 0;
  1791. }
  1792. }
  1793. <?php
  1794. namespace Composer\Command;
  1795. use Composer\Util\Platform;
  1796. use Composer\Util\Silencer;
  1797. use Symfony\Component\Console\Input\InputInterface;
  1798. use Symfony\Component\Console\Input\InputArgument;
  1799. use Symfony\Component\Console\Input\InputOption;
  1800. use Symfony\Component\Console\Output\OutputInterface;
  1801. use Composer\Config;
  1802. use Composer\Config\JsonConfigSource;
  1803. use Composer\Factory;
  1804. use Composer\IO\IOInterface;
  1805. use Composer\Json\JsonFile;
  1806. use Composer\Semver\VersionParser;
  1807. use Composer\Package\BasePackage;
  1808. class ConfigCommand extends BaseCommand
  1809. {
  1810. protected $config;
  1811. protected $configFile;
  1812. protected $configSource;
  1813. protected $authConfigFile;
  1814. protected $authConfigSource;
  1815. protected function configure()
  1816. {
  1817. $this
  1818. ->setName('config')
  1819. ->setDescription('Sets config options.')
  1820. ->setDefinition(array(
  1821. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1822. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1823. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1824. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1825. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1826. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1827. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1828. new InputArgument('setting-key', null, 'Setting key'),
  1829. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1830. ))
  1831. ->setHelp(
  1832. <<<EOT
  1833. This command allows you to edit composer config settings and repositories
  1834. in either the local composer.json file or the global config.json file.
  1835. Additionally it lets you edit most properties in the local composer.json.
  1836. To set a config setting:
  1837. <comment>%command.full_name% bin-dir bin/</comment>
  1838. To read a config setting:
  1839. <comment>%command.full_name% bin-dir</comment>
  1840. Outputs: <info>bin</info>
  1841. To edit the global config.json file:
  1842. <comment>%command.full_name% --global</comment>
  1843. To add a repository:
  1844. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1845. To remove a repository (repo is a short alias for repositories):
  1846. <comment>%command.full_name% --unset repo.foo</comment>
  1847. To disable packagist:
  1848. <comment>%command.full_name% repo.packagist false</comment>
  1849. You can alter repositories in the global config.json file by passing in the
  1850. <info>--global</info> option.
  1851. To add or edit suggested packages you can use:
  1852. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  1853. To add or edit extra properties you can use:
  1854. <comment>%command.full_name% extra.property value</comment>
  1855. To edit the file in an external editor:
  1856. <comment>%command.full_name% --editor</comment>
  1857. To choose your editor you can set the "EDITOR" env variable.
  1858. To get a list of configuration values in the file:
  1859. <comment>%command.full_name% --list</comment>
  1860. You can always pass more than one option. As an example, if you want to edit the
  1861. global config.json file.
  1862. <comment>%command.full_name% --editor --global</comment>
  1863. Read more at https://getcomposer.org/doc/03-cli.md#config
  1864. EOT
  1865. )
  1866. ;
  1867. }
  1868. protected function initialize(InputInterface $input, OutputInterface $output)
  1869. {
  1870. parent::initialize($input, $output);
  1871. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1872. throw new \RuntimeException('--file and --global can not be combined');
  1873. }
  1874. $io = $this->getIO();
  1875. $this->config = Factory::createConfig($io);
  1876. $configFile = $input->getOption('global')
  1877. ? ($this->config->get('home') . '/config.json')
  1878. : ($input->getOption('file') ?: Factory::getComposerFile());
  1879. if (
  1880. ($configFile === 'composer.json' || $configFile === './composer.json')
  1881. && !file_exists($configFile)
  1882. && realpath(getcwd()) === realpath($this->config->get('home'))
  1883. ) {
  1884. file_put_contents($configFile, "{\n}\n");
  1885. }
  1886. $this->configFile = new JsonFile($configFile, null, $io);
  1887. $this->configSource = new JsonConfigSource($this->configFile);
  1888. $authConfigFile = $input->getOption('global')
  1889. ? ($this->config->get('home') . '/auth.json')
  1890. : dirname(realpath($configFile)) . '/auth.json';
  1891. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1892. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1893. if ($input->getOption('global') && !$this->configFile->exists()) {
  1894. touch($this->configFile->getPath());
  1895. $this->configFile->write(array('config' => new \ArrayObject));
  1896. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1897. }
  1898. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1899. touch($this->authConfigFile->getPath());
  1900. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject));
  1901. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1902. }
  1903. if (!$this->configFile->exists()) {
  1904. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1905. }
  1906. }
  1907. protected function execute(InputInterface $input, OutputInterface $output)
  1908. {
  1909. if ($input->getOption('editor')) {
  1910. $editor = escapeshellcmd(getenv('EDITOR'));
  1911. if (!$editor) {
  1912. if (Platform::isWindows()) {
  1913. $editor = 'notepad';
  1914. } else {
  1915. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1916. if (exec('which '.$candidate)) {
  1917. $editor = $candidate;
  1918. break;
  1919. }
  1920. }
  1921. }
  1922. }
  1923. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1924. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1925. return 0;
  1926. }
  1927. if (!$input->getOption('global')) {
  1928. $this->config->merge($this->configFile->read());
  1929. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1930. }
  1931. if ($input->getOption('list')) {
  1932. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1933. return 0;
  1934. }
  1935. $settingKey = $input->getArgument('setting-key');
  1936. if (!$settingKey) {
  1937. return 0;
  1938. }
  1939. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1940. throw new \RuntimeException('You can not combine a setting value with --unset');
  1941. }
  1942. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1943. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1944. $rawData = $this->configFile->read();
  1945. $data = $this->config->all();
  1946. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1947. if (!isset($matches[1]) || $matches[1] === '') {
  1948. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1949. } else {
  1950. if (!isset($data['repositories'][$matches[1]])) {
  1951. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1952. }
  1953. $value = $data['repositories'][$matches[1]];
  1954. }
  1955. } elseif (strpos($settingKey, '.')) {
  1956. $bits = explode('.', $settingKey);
  1957. if ($bits[0] === 'extra') {
  1958. $data = $rawData;
  1959. } else {
  1960. $data = $data['config'];
  1961. }
  1962. $match = false;
  1963. foreach ($bits as $bit) {
  1964. $key = isset($key) ? $key.'.'.$bit : $bit;
  1965. $match = false;
  1966. if (isset($data[$key])) {
  1967. $match = true;
  1968. $data = $data[$key];
  1969. unset($key);
  1970. }
  1971. }
  1972. if (!$match) {
  1973. throw new \RuntimeException($settingKey.' is not defined.');
  1974. }
  1975. $value = $data;
  1976. } elseif (isset($data['config'][$settingKey])) {
  1977. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1978. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1979. $value = $rawData[$settingKey];
  1980. } else {
  1981. throw new \RuntimeException($settingKey.' is not defined');
  1982. }
  1983. if (is_array($value)) {
  1984. $value = json_encode($value);
  1985. }
  1986. $this->getIO()->write($value, true, IOInterface::QUIET);
  1987. return 0;
  1988. }
  1989. $values = $input->getArgument('setting-value');
  1990. $booleanValidator = function ($val) {
  1991. return in_array($val, array('true', 'false', '1', '0'), true);
  1992. };
  1993. $booleanNormalizer = function ($val) {
  1994. return $val !== 'false' && (bool) $val;
  1995. };
  1996. $uniqueConfigValues = array(
  1997. 'process-timeout' => array('is_numeric', 'intval'),
  1998. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1999. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  2000. 'preferred-install' => array(
  2001. function ($val) {
  2002. return in_array($val, array('auto', 'source', 'dist'), true);
  2003. },
  2004. function ($val) {
  2005. return $val;
  2006. },
  2007. ),
  2008. 'store-auths' => array(
  2009. function ($val) {
  2010. return in_array($val, array('true', 'false', 'prompt'), true);
  2011. },
  2012. function ($val) {
  2013. if ('prompt' === $val) {
  2014. return 'prompt';
  2015. }
  2016. return $val !== 'false' && (bool) $val;
  2017. },
  2018. ),
  2019. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  2020. 'vendor-dir' => array('is_string', function ($val) {
  2021. return $val;
  2022. }),
  2023. 'bin-dir' => array('is_string', function ($val) {
  2024. return $val;
  2025. }),
  2026. 'archive-dir' => array('is_string', function ($val) {
  2027. return $val;
  2028. }),
  2029. 'archive-format' => array('is_string', function ($val) {
  2030. return $val;
  2031. }),
  2032. 'data-dir' => array('is_string', function ($val) {
  2033. return $val;
  2034. }),
  2035. 'cache-dir' => array('is_string', function ($val) {
  2036. return $val;
  2037. }),
  2038. 'cache-files-dir' => array('is_string', function ($val) {
  2039. return $val;
  2040. }),
  2041. 'cache-repo-dir' => array('is_string', function ($val) {
  2042. return $val;
  2043. }),
  2044. 'cache-vcs-dir' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'cache-ttl' => array('is_numeric', 'intval'),
  2048. 'cache-files-ttl' => array('is_numeric', 'intval'),
  2049. 'cache-files-maxsize' => array(
  2050. function ($val) {
  2051. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  2052. },
  2053. function ($val) {
  2054. return $val;
  2055. },
  2056. ),
  2057. 'bin-compat' => array(
  2058. function ($val) {
  2059. return in_array($val, array('auto', 'full'));
  2060. },
  2061. function ($val) {
  2062. return $val;
  2063. },
  2064. ),
  2065. 'discard-changes' => array(
  2066. function ($val) {
  2067. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2068. },
  2069. function ($val) {
  2070. if ('stash' === $val) {
  2071. return 'stash';
  2072. }
  2073. return $val !== 'false' && (bool) $val;
  2074. },
  2075. ),
  2076. 'autoloader-suffix' => array('is_string', function ($val) {
  2077. return $val === 'null' ? null : $val;
  2078. }),
  2079. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2080. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2081. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2082. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2083. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2084. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2085. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2086. 'cafile' => array(
  2087. function ($val) {
  2088. return file_exists($val) && is_readable($val);
  2089. },
  2090. function ($val) {
  2091. return $val === 'null' ? null : $val;
  2092. },
  2093. ),
  2094. 'capath' => array(
  2095. function ($val) {
  2096. return is_dir($val) && is_readable($val);
  2097. },
  2098. function ($val) {
  2099. return $val === 'null' ? null : $val;
  2100. },
  2101. ),
  2102. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2103. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2104. 'lock' => array($booleanValidator, $booleanNormalizer),
  2105. );
  2106. $multiConfigValues = array(
  2107. 'github-protocols' => array(
  2108. function ($vals) {
  2109. if (!is_array($vals)) {
  2110. return 'array expected';
  2111. }
  2112. foreach ($vals as $val) {
  2113. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2114. return 'valid protocols include: git, https, ssh';
  2115. }
  2116. }
  2117. return true;
  2118. },
  2119. function ($vals) {
  2120. return $vals;
  2121. },
  2122. ),
  2123. 'github-domains' => array(
  2124. function ($vals) {
  2125. if (!is_array($vals)) {
  2126. return 'array expected';
  2127. }
  2128. return true;
  2129. },
  2130. function ($vals) {
  2131. return $vals;
  2132. },
  2133. ),
  2134. 'gitlab-domains' => array(
  2135. function ($vals) {
  2136. if (!is_array($vals)) {
  2137. return 'array expected';
  2138. }
  2139. return true;
  2140. },
  2141. function ($vals) {
  2142. return $vals;
  2143. },
  2144. ),
  2145. );
  2146. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2147. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2148. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2149. }
  2150. $this->configSource->removeConfigSetting($settingKey);
  2151. return 0;
  2152. }
  2153. if (isset($uniqueConfigValues[$settingKey])) {
  2154. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2155. return 0;
  2156. }
  2157. if (isset($multiConfigValues[$settingKey])) {
  2158. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2159. return 0;
  2160. }
  2161. if (preg_match('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  2162. if ($input->getOption('unset')) {
  2163. $this->configSource->removeConfigSetting($settingKey);
  2164. return 0;
  2165. }
  2166. list($validator) = $uniqueConfigValues['preferred-install'];
  2167. if (!$validator($values[0])) {
  2168. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  2169. }
  2170. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2171. return 0;
  2172. }
  2173. $uniqueProps = array(
  2174. 'name' => array('is_string', function ($val) {
  2175. return $val;
  2176. }),
  2177. 'type' => array('is_string', function ($val) {
  2178. return $val;
  2179. }),
  2180. 'description' => array('is_string', function ($val) {
  2181. return $val;
  2182. }),
  2183. 'homepage' => array('is_string', function ($val) {
  2184. return $val;
  2185. }),
  2186. 'version' => array('is_string', function ($val) {
  2187. return $val;
  2188. }),
  2189. 'minimum-stability' => array(
  2190. function ($val) {
  2191. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2192. },
  2193. function ($val) {
  2194. return VersionParser::normalizeStability($val);
  2195. },
  2196. ),
  2197. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2198. );
  2199. $multiProps = array(
  2200. 'keywords' => array(
  2201. function ($vals) {
  2202. if (!is_array($vals)) {
  2203. return 'array expected';
  2204. }
  2205. return true;
  2206. },
  2207. function ($vals) {
  2208. return $vals;
  2209. },
  2210. ),
  2211. 'license' => array(
  2212. function ($vals) {
  2213. if (!is_array($vals)) {
  2214. return 'array expected';
  2215. }
  2216. return true;
  2217. },
  2218. function ($vals) {
  2219. return $vals;
  2220. },
  2221. ),
  2222. );
  2223. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2224. 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');
  2225. }
  2226. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2227. $this->configSource->removeProperty($settingKey);
  2228. return 0;
  2229. }
  2230. if (isset($uniqueProps[$settingKey])) {
  2231. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2232. return 0;
  2233. }
  2234. if (isset($multiProps[$settingKey])) {
  2235. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2236. return 0;
  2237. }
  2238. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2239. if ($input->getOption('unset')) {
  2240. $this->configSource->removeRepository($matches[1]);
  2241. return 0;
  2242. }
  2243. if (2 === count($values)) {
  2244. $this->configSource->addRepository($matches[1], array(
  2245. 'type' => $values[0],
  2246. 'url' => $values[1],
  2247. ));
  2248. return 0;
  2249. }
  2250. if (1 === count($values)) {
  2251. $value = strtolower($values[0]);
  2252. if (true === $booleanValidator($value)) {
  2253. if (false === $booleanNormalizer($value)) {
  2254. $this->configSource->addRepository($matches[1], false);
  2255. return 0;
  2256. }
  2257. } else {
  2258. $value = JsonFile::parseJson($values[0]);
  2259. $this->configSource->addRepository($matches[1], $value);
  2260. return 0;
  2261. }
  2262. }
  2263. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2264. }
  2265. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2266. if ($input->getOption('unset')) {
  2267. $this->configSource->removeProperty($settingKey);
  2268. return 0;
  2269. }
  2270. $this->configSource->addProperty($settingKey, $values[0]);
  2271. return 0;
  2272. }
  2273. if (preg_match('/^suggest\.(.+)/', $settingKey, $matches)) {
  2274. if ($input->getOption('unset')) {
  2275. $this->configSource->removeProperty($settingKey);
  2276. return 0;
  2277. }
  2278. $this->configSource->addProperty($settingKey, implode(' ', $values));
  2279. return 0;
  2280. }
  2281. if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {
  2282. $this->configSource->removeProperty($settingKey);
  2283. return 0;
  2284. }
  2285. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2286. if ($input->getOption('unset')) {
  2287. $this->configSource->removeConfigSetting($settingKey);
  2288. return 0;
  2289. }
  2290. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2291. return 0;
  2292. }
  2293. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2294. $this->configSource->removeConfigSetting($settingKey);
  2295. return 0;
  2296. }
  2297. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  2298. if ($input->getOption('unset')) {
  2299. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2300. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2301. return 0;
  2302. }
  2303. if ($matches[1] === 'bitbucket-oauth') {
  2304. if (2 !== count($values)) {
  2305. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2306. }
  2307. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2308. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2309. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'), true)) {
  2310. if (1 !== count($values)) {
  2311. throw new \RuntimeException('Too many arguments, expected only one token');
  2312. }
  2313. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2314. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2315. } elseif ($matches[1] === 'http-basic') {
  2316. if (2 !== count($values)) {
  2317. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2318. }
  2319. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2320. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2321. }
  2322. return 0;
  2323. }
  2324. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2325. if ($input->getOption('unset')) {
  2326. $this->configSource->removeProperty($settingKey);
  2327. return 0;
  2328. }
  2329. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2330. return 0;
  2331. }
  2332. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2333. }
  2334. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2335. {
  2336. list($validator, $normalizer) = $callbacks;
  2337. if (1 !== count($values)) {
  2338. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2339. }
  2340. if (true !== $validation = $validator($values[0])) {
  2341. throw new \RuntimeException(sprintf(
  2342. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2343. $values[0]
  2344. ));
  2345. }
  2346. $normalizedValue = $normalizer($values[0]);
  2347. if ($key === 'disable-tls') {
  2348. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2349. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2350. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2351. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2352. }
  2353. }
  2354. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2355. }
  2356. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2357. {
  2358. list($validator, $normalizer) = $callbacks;
  2359. if (true !== $validation = $validator($values)) {
  2360. throw new \RuntimeException(sprintf(
  2361. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2362. json_encode($values)
  2363. ));
  2364. }
  2365. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2366. }
  2367. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2368. {
  2369. $origK = $k;
  2370. $io = $this->getIO();
  2371. foreach ($contents as $key => $value) {
  2372. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2373. continue;
  2374. }
  2375. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2376. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2377. $k .= preg_replace('{^config\.}', '', $key . '.');
  2378. $this->listConfiguration($value, $rawVal, $output, $k);
  2379. $k = $origK;
  2380. continue;
  2381. }
  2382. if (is_array($value)) {
  2383. $value = array_map(function ($val) {
  2384. return is_array($val) ? json_encode($val) : $val;
  2385. }, $value);
  2386. $value = '['.implode(', ', $value).']';
  2387. }
  2388. if (is_bool($value)) {
  2389. $value = var_export($value, true);
  2390. }
  2391. if (is_string($rawVal) && $rawVal != $value) {
  2392. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2393. } else {
  2394. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2395. }
  2396. }
  2397. }
  2398. }
  2399. <?php
  2400. namespace Composer\Command;
  2401. use Composer\Config;
  2402. use Composer\Factory;
  2403. use Composer\Installer;
  2404. use Composer\Installer\ProjectInstaller;
  2405. use Composer\Installer\InstallationManager;
  2406. use Composer\Installer\SuggestedPackagesReporter;
  2407. use Composer\IO\IOInterface;
  2408. use Composer\Package\BasePackage;
  2409. use Composer\DependencyResolver\Pool;
  2410. use Composer\DependencyResolver\Operation\InstallOperation;
  2411. use Composer\Package\Version\VersionSelector;
  2412. use Composer\Package\AliasPackage;
  2413. use Composer\Repository\RepositoryFactory;
  2414. use Composer\Repository\CompositeRepository;
  2415. use Composer\Repository\PlatformRepository;
  2416. use Composer\Repository\InstalledFilesystemRepository;
  2417. use Composer\Script\ScriptEvents;
  2418. use Composer\Util\Silencer;
  2419. use Symfony\Component\Console\Input\InputArgument;
  2420. use Symfony\Component\Console\Input\InputInterface;
  2421. use Symfony\Component\Console\Input\InputOption;
  2422. use Symfony\Component\Console\Output\OutputInterface;
  2423. use Symfony\Component\Finder\Finder;
  2424. use Composer\Json\JsonFile;
  2425. use Composer\Config\JsonConfigSource;
  2426. use Composer\Util\Filesystem;
  2427. use Composer\Package\Version\VersionParser;
  2428. use Composer\EventDispatcher\EventDispatcher;
  2429. class CreateProjectCommand extends BaseCommand
  2430. {
  2431. protected $suggestedPackagesReporter;
  2432. protected function configure()
  2433. {
  2434. $this
  2435. ->setName('create-project')
  2436. ->setDescription('Creates new project from a package into given directory.')
  2437. ->setDefinition(array(
  2438. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2439. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2440. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2441. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2442. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2443. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2444. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2445. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2446. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the repository option to the composer.json.'),
  2447. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2448. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2449. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2450. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2451. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2452. 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.'),
  2453. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2454. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2455. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2456. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2457. ))
  2458. ->setHelp(
  2459. <<<EOT
  2460. The <info>create-project</info> command creates a new project from a given
  2461. package into a new directory. If executed without params and in a directory
  2462. with a composer.json file it installs the packages for the current project.
  2463. You can use this command to bootstrap new projects or setup a clean
  2464. version-controlled installation for developers of your project.
  2465. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2466. You can also specify the version with the package name using = or : as separator.
  2467. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2468. To install unstable packages, either specify the version you want, or use the
  2469. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2470. To setup a developer workable version you should create the project using the source
  2471. controlled code by appending the <info>'--prefer-source'</info> flag.
  2472. To install a package from another repository than the default one you
  2473. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2474. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2475. EOT
  2476. )
  2477. ;
  2478. }
  2479. protected function execute(InputInterface $input, OutputInterface $output)
  2480. {
  2481. $config = Factory::createConfig();
  2482. $io = $this->getIO();
  2483. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2484. if ($input->getOption('dev')) {
  2485. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2486. }
  2487. if ($input->getOption('no-custom-installers')) {
  2488. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2489. $input->setOption('no-plugins', true);
  2490. }
  2491. return $this->installProject(
  2492. $io,
  2493. $config,
  2494. $input,
  2495. $input->getArgument('package'),
  2496. $input->getArgument('directory'),
  2497. $input->getArgument('version'),
  2498. $input->getOption('stability'),
  2499. $preferSource,
  2500. $preferDist,
  2501. !$input->getOption('no-dev'),
  2502. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2503. $input->getOption('no-plugins'),
  2504. $input->getOption('no-scripts'),
  2505. $input->getOption('no-progress'),
  2506. $input->getOption('no-install'),
  2507. $input->getOption('ignore-platform-reqs'),
  2508. !$input->getOption('no-secure-http'),
  2509. $input->getOption('add-repository')
  2510. );
  2511. }
  2512. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
  2513. {
  2514. $oldCwd = getcwd();
  2515. $io->loadConfiguration($config);
  2516. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2517. if ($packageName !== null) {
  2518. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2519. } else {
  2520. $installedFromVcs = false;
  2521. }
  2522. $composer = Factory::create($io, null, $disablePlugins);
  2523. if ($repository !== null && $addRepository) {
  2524. if ($composer->getLocker()->isLocked()) {
  2525. $io->writeError('<error>Adding a repository when creating a project that provides a composer.lock file is not supported</error>');
  2526. return false;
  2527. }
  2528. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repository, true);
  2529. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  2530. $name = RepositoryFactory::generateRepositoryName(0, $repoConfig, $composerJsonRepositoriesConfig);
  2531. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2532. $configSource->addRepository($name, $repoConfig);
  2533. $composer = Factory::create($io, null, $disablePlugins);
  2534. }
  2535. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2536. $fs = new Filesystem();
  2537. if ($noScripts === false) {
  2538. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2539. }
  2540. $config = $composer->getConfig();
  2541. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2542. if ($noInstall === false) {
  2543. $installer = Installer::create($io, $composer);
  2544. $installer->setPreferSource($preferSource)
  2545. ->setPreferDist($preferDist)
  2546. ->setDevMode($installDevPackages)
  2547. ->setRunScripts(!$noScripts)
  2548. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2549. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2550. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2551. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2552. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2553. if ($disablePlugins) {
  2554. $installer->disablePlugins();
  2555. }
  2556. $status = $installer->run();
  2557. if (0 !== $status) {
  2558. return $status;
  2559. }
  2560. }
  2561. $hasVcs = $installedFromVcs;
  2562. if (
  2563. !$input->getOption('keep-vcs')
  2564. && $installedFromVcs
  2565. && (
  2566. $input->getOption('remove-vcs')
  2567. || !$io->isInteractive()
  2568. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2569. )
  2570. ) {
  2571. $finder = new Finder();
  2572. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2573. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2574. $finder->name($vcsName);
  2575. }
  2576. try {
  2577. $dirs = iterator_to_array($finder);
  2578. unset($finder);
  2579. foreach ($dirs as $dir) {
  2580. if (!$fs->removeDirectory($dir)) {
  2581. throw new \RuntimeException('Could not remove '.$dir);
  2582. }
  2583. }
  2584. } catch (\Exception $e) {
  2585. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2586. }
  2587. $hasVcs = false;
  2588. }
  2589. if (!$hasVcs) {
  2590. $package = $composer->getPackage();
  2591. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2592. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2593. foreach ($package->{'get'.$meta['method']}() as $link) {
  2594. if ($link->getPrettyConstraint() === 'self.version') {
  2595. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2596. }
  2597. }
  2598. }
  2599. }
  2600. if ($noScripts === false) {
  2601. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2602. }
  2603. chdir($oldCwd);
  2604. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2605. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2606. Silencer::call('rmdir', $vendorComposerDir);
  2607. $vendorDir = $config->get('vendor-dir');
  2608. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2609. Silencer::call('rmdir', $vendorDir);
  2610. }
  2611. }
  2612. return 0;
  2613. }
  2614. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2615. {
  2616. if (!$secureHttp) {
  2617. $config->merge(array('config' => array('secure-http' => false)));
  2618. }
  2619. $composer = Factory::create($io, $config->all(), $disablePlugins);
  2620. $config = $composer->getConfig();
  2621. $rm = $composer->getRepositoryManager();
  2622. if (null === $repository) {
  2623. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
  2624. } else {
  2625. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true, $rm);
  2626. }
  2627. $parser = new VersionParser();
  2628. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2629. $name = strtolower($requirements[0]['name']);
  2630. if (!$packageVersion && isset($requirements[0]['version'])) {
  2631. $packageVersion = $requirements[0]['version'];
  2632. }
  2633. if (null === $directory) {
  2634. $parts = explode("/", $name, 2);
  2635. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2636. }
  2637. $fs = new Filesystem();
  2638. if (!$fs->isAbsolutePath($directory)) {
  2639. $directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
  2640. }
  2641. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(getcwd(), $directory, true) . '"</info>');
  2642. if (file_exists($directory)) {
  2643. if (!is_dir($directory)) {
  2644. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  2645. } elseif (!$fs->isDirEmpty($directory)) {
  2646. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  2647. }
  2648. }
  2649. if (null === $stability) {
  2650. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2651. $stability = $match[1];
  2652. } else {
  2653. $stability = VersionParser::parseStability($packageVersion);
  2654. }
  2655. }
  2656. $stability = VersionParser::normalizeStability($stability);
  2657. if (!isset(BasePackage::$stabilities[$stability])) {
  2658. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2659. }
  2660. $pool = new Pool($stability);
  2661. $pool->addRepository($sourceRepo);
  2662. $phpVersion = null;
  2663. $prettyPhpVersion = null;
  2664. if (!$ignorePlatformReqs) {
  2665. $platformOverrides = $config->get('platform') ?: array();
  2666. $platform = new PlatformRepository(array(), $platformOverrides);
  2667. $phpPackage = $platform->findPackage('php', '*');
  2668. $phpVersion = $phpPackage->getVersion();
  2669. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2670. }
  2671. $versionSelector = new VersionSelector($pool);
  2672. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2673. if (!$package) {
  2674. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2675. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2676. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2677. }
  2678. throw new \InvalidArgumentException($errorMessage .'.');
  2679. }
  2680. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  2681. @mkdir($directory, 0777, true);
  2682. if ($realDir = realpath($directory)) {
  2683. pcntl_async_signals(true);
  2684. pcntl_signal(SIGINT, function () use ($realDir) {
  2685. $fs = new Filesystem();
  2686. $fs->removeDirectory($realDir);
  2687. exit(130);
  2688. });
  2689. }
  2690. }
  2691. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2692. if ($disablePlugins) {
  2693. $io->writeError('<info>Plugins have been disabled.</info>');
  2694. }
  2695. if ($package instanceof AliasPackage) {
  2696. $package = $package->getAliasOf();
  2697. }
  2698. $dm = $composer->getDownloadManager();
  2699. $dm->setPreferSource($preferSource)
  2700. ->setPreferDist($preferDist)
  2701. ->setOutputProgress(!$noProgress);
  2702. $projectInstaller = new ProjectInstaller($directory, $dm);
  2703. $im = $composer->getInstallationManager();
  2704. $im->addInstaller($projectInstaller);
  2705. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2706. $im->notifyInstalls($io);
  2707. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2708. $installedFromVcs = 'source' === $package->getInstallationSource();
  2709. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2710. chdir($directory);
  2711. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2712. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2713. return $installedFromVcs;
  2714. }
  2715. }
  2716. <?php
  2717. namespace Composer\Command;
  2718. use Symfony\Component\Console\Input\InputInterface;
  2719. use Symfony\Component\Console\Output\OutputInterface;
  2720. class DependsCommand extends BaseDependencyCommand
  2721. {
  2722. protected function configure()
  2723. {
  2724. parent::configure();
  2725. $this
  2726. ->setName('depends')
  2727. ->setAliases(array('why'))
  2728. ->setDescription('Shows which packages cause the given package to be installed.')
  2729. ->setHelp(
  2730. <<<EOT
  2731. Displays detailed information about where a package is referenced.
  2732. <info>php composer.phar depends composer/composer</info>
  2733. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2734. EOT
  2735. )
  2736. ;
  2737. }
  2738. protected function execute(InputInterface $input, OutputInterface $output)
  2739. {
  2740. return parent::doExecute($input, $output, false);
  2741. }
  2742. }
  2743. <?php
  2744. namespace Composer\Command;
  2745. use Composer\Composer;
  2746. use Composer\Factory;
  2747. use Composer\Config;
  2748. use Composer\Downloader\TransportException;
  2749. use Composer\Repository\PlatformRepository;
  2750. use Composer\Plugin\CommandEvent;
  2751. use Composer\Plugin\PluginEvents;
  2752. use Composer\Util\ConfigValidator;
  2753. use Composer\Util\IniHelper;
  2754. use Composer\Util\ProcessExecutor;
  2755. use Composer\Util\RemoteFilesystem;
  2756. use Composer\Util\StreamContextFactory;
  2757. use Composer\SelfUpdate\Keys;
  2758. use Composer\SelfUpdate\Versions;
  2759. use Composer\IO\NullIO;
  2760. use Symfony\Component\Console\Input\InputInterface;
  2761. use Symfony\Component\Console\Output\OutputInterface;
  2762. class DiagnoseCommand extends BaseCommand
  2763. {
  2764. protected $rfs;
  2765. protected $process;
  2766. protected $exitCode = 0;
  2767. protected function configure()
  2768. {
  2769. $this
  2770. ->setName('diagnose')
  2771. ->setDescription('Diagnoses the system to identify common errors.')
  2772. ->setHelp(
  2773. <<<EOT
  2774. The <info>diagnose</info> command checks common errors to help debugging problems.
  2775. The process exit code will be 1 in case of warnings and 2 for errors.
  2776. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2777. EOT
  2778. )
  2779. ;
  2780. }
  2781. protected function execute(InputInterface $input, OutputInterface $output)
  2782. {
  2783. $composer = $this->getComposer(false);
  2784. $io = $this->getIO();
  2785. if ($composer) {
  2786. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2787. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2788. $io->write('Checking composer.json: ', false);
  2789. $this->outputResult($this->checkComposerSchema());
  2790. }
  2791. if ($composer) {
  2792. $config = $composer->getConfig();
  2793. } else {
  2794. $config = Factory::createConfig();
  2795. }
  2796. $config->merge(array('config' => array('secure-http' => false)));
  2797. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2798. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2799. $this->process = new ProcessExecutor($io);
  2800. $io->write('Checking platform settings: ', false);
  2801. $this->outputResult($this->checkPlatform());
  2802. $io->write('Checking git settings: ', false);
  2803. $this->outputResult($this->checkGit());
  2804. $io->write('Checking http connectivity to packagist: ', false);
  2805. $this->outputResult($this->checkHttp('http', $config));
  2806. $io->write('Checking https connectivity to packagist: ', false);
  2807. $this->outputResult($this->checkHttp('https', $config));
  2808. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2809. if (!empty($opts['http']['proxy'])) {
  2810. $io->write('Checking HTTP proxy: ', false);
  2811. $this->outputResult($this->checkHttpProxy());
  2812. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2813. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2814. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2815. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2816. }
  2817. if ($oauth = $config->get('github-oauth')) {
  2818. foreach ($oauth as $domain => $token) {
  2819. $io->write('Checking '.$domain.' oauth access: ', false);
  2820. $this->outputResult($this->checkGithubOauth($domain, $token));
  2821. }
  2822. } else {
  2823. $io->write('Checking github.com rate limit: ', false);
  2824. try {
  2825. $rate = $this->getGithubRateLimit('github.com');
  2826. if (!is_array($rate)) {
  2827. $this->outputResult($rate);
  2828. } elseif (10 > $rate['remaining']) {
  2829. $io->write('<warning>WARNING</warning>');
  2830. $io->write(sprintf(
  2831. '<comment>Github has a rate limit on their API. '
  2832. . 'You currently have <options=bold>%u</options=bold> '
  2833. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2834. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2835. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2836. $rate['remaining'],
  2837. $rate['limit']
  2838. ));
  2839. } else {
  2840. $this->outputResult(true);
  2841. }
  2842. } catch (\Exception $e) {
  2843. if ($e instanceof TransportException && $e->getCode() === 401) {
  2844. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2845. } else {
  2846. $this->outputResult($e);
  2847. }
  2848. }
  2849. }
  2850. $io->write('Checking disk free space: ', false);
  2851. $this->outputResult($this->checkDiskSpace($config));
  2852. if ('phar:' === substr(__FILE__, 0, 5)) {
  2853. $io->write('Checking pubkeys: ', false);
  2854. $this->outputResult($this->checkPubKeys($config));
  2855. $io->write('Checking composer version: ', false);
  2856. $this->outputResult($this->checkVersion($config));
  2857. }
  2858. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2859. $platformOverrides = $config->get('platform') ?: array();
  2860. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2861. $phpPkg = $platformRepo->findPackage('php', '*');
  2862. $phpVersion = $phpPkg->getPrettyVersion();
  2863. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2864. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2865. }
  2866. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2867. if (defined('PHP_BINARY')) {
  2868. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2869. }
  2870. $io->write(sprintf('OpenSSL version: <comment>%s</comment>', OPENSSL_VERSION_TEXT));
  2871. return $this->exitCode;
  2872. }
  2873. private function checkComposerSchema()
  2874. {
  2875. $validator = new ConfigValidator($this->getIO());
  2876. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2877. if ($errors || $warnings) {
  2878. $messages = array(
  2879. 'error' => $errors,
  2880. 'warning' => $warnings,
  2881. );
  2882. $output = '';
  2883. foreach ($messages as $style => $msgs) {
  2884. foreach ($msgs as $msg) {
  2885. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2886. }
  2887. }
  2888. return rtrim($output);
  2889. }
  2890. return true;
  2891. }
  2892. private function checkGit()
  2893. {
  2894. $this->process->execute('git config color.ui', $output);
  2895. if (strtolower(trim($output)) === 'always') {
  2896. 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>';
  2897. }
  2898. return true;
  2899. }
  2900. private function checkHttp($proto, Config $config)
  2901. {
  2902. $result = $this->checkConnectivity();
  2903. if ($result !== true) {
  2904. return $result;
  2905. }
  2906. $disableTls = false;
  2907. $result = array();
  2908. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2909. $disableTls = true;
  2910. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2911. }
  2912. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2913. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2914. }
  2915. try {
  2916. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2917. } catch (TransportException $e) {
  2918. if (false !== strpos($e->getMessage(), 'cafile')) {
  2919. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2920. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2921. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2922. } else {
  2923. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2924. }
  2925. }
  2926. if (count($result) > 0) {
  2927. return $result;
  2928. }
  2929. return true;
  2930. }
  2931. private function checkHttpProxy()
  2932. {
  2933. $result = $this->checkConnectivity();
  2934. if ($result !== true) {
  2935. return $result;
  2936. }
  2937. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2938. try {
  2939. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2940. $hash = reset($json['provider-includes']);
  2941. $hash = $hash['sha256'];
  2942. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2943. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2944. if (hash('sha256', $provider) !== $hash) {
  2945. return 'It seems that your proxy is modifying http traffic on the fly';
  2946. }
  2947. } catch (\Exception $e) {
  2948. return $e;
  2949. }
  2950. return true;
  2951. }
  2952. private function checkHttpProxyFullUriRequestParam()
  2953. {
  2954. $result = $this->checkConnectivity();
  2955. if ($result !== true) {
  2956. return $result;
  2957. }
  2958. $url = 'http://repo.packagist.org/packages.json';
  2959. try {
  2960. $this->rfs->getContents('packagist.org', $url, false);
  2961. } catch (TransportException $e) {
  2962. try {
  2963. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2964. } catch (TransportException $e) {
  2965. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2966. }
  2967. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2968. }
  2969. return true;
  2970. }
  2971. private function checkHttpsProxyFullUriRequestParam()
  2972. {
  2973. $result = $this->checkConnectivity();
  2974. if ($result !== true) {
  2975. return $result;
  2976. }
  2977. if (!extension_loaded('openssl')) {
  2978. return 'You need the openssl extension installed for this check';
  2979. }
  2980. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2981. try {
  2982. $this->rfs->getContents('github.com', $url, false);
  2983. } catch (TransportException $e) {
  2984. try {
  2985. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2986. } catch (TransportException $e) {
  2987. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2988. }
  2989. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2990. }
  2991. return true;
  2992. }
  2993. private function checkGithubOauth($domain, $token)
  2994. {
  2995. $result = $this->checkConnectivity();
  2996. if ($result !== true) {
  2997. return $result;
  2998. }
  2999. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3000. try {
  3001. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  3002. return $this->rfs->getContents($domain, $url, false, array(
  3003. 'retry-auth-failure' => false,
  3004. )) ? true : 'Unexpected error';
  3005. } catch (\Exception $e) {
  3006. if ($e instanceof TransportException && $e->getCode() === 401) {
  3007. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  3008. }
  3009. return $e;
  3010. }
  3011. }
  3012. private function getGithubRateLimit($domain, $token = null)
  3013. {
  3014. $result = $this->checkConnectivity();
  3015. if ($result !== true) {
  3016. return $result;
  3017. }
  3018. if ($token) {
  3019. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3020. }
  3021. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  3022. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  3023. $data = json_decode($json, true);
  3024. return $data['resources']['core'];
  3025. }
  3026. private function checkDiskSpace($config)
  3027. {
  3028. $minSpaceFree = 1024 * 1024;
  3029. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  3030. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  3031. ) {
  3032. return '<error>The disk hosting '.$dir.' is full</error>';
  3033. }
  3034. return true;
  3035. }
  3036. private function checkPubKeys($config)
  3037. {
  3038. $home = $config->get('home');
  3039. $errors = array();
  3040. $io = $this->getIO();
  3041. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  3042. $io->write('');
  3043. }
  3044. if (file_exists($home.'/keys.tags.pub')) {
  3045. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  3046. } else {
  3047. $errors[] = '<error>Missing pubkey for tags verification</error>';
  3048. }
  3049. if (file_exists($home.'/keys.dev.pub')) {
  3050. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  3051. } else {
  3052. $errors[] = '<error>Missing pubkey for dev verification</error>';
  3053. }
  3054. if ($errors) {
  3055. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  3056. }
  3057. return $errors ?: true;
  3058. }
  3059. private function checkVersion($config)
  3060. {
  3061. $result = $this->checkConnectivity();
  3062. if ($result !== true) {
  3063. return $result;
  3064. }
  3065. $versionsUtil = new Versions($config, $this->rfs);
  3066. try {
  3067. $latest = $versionsUtil->getLatest();
  3068. } catch (\Exception $e) {
  3069. return $e;
  3070. }
  3071. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  3072. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  3073. }
  3074. return true;
  3075. }
  3076. private function outputResult($result)
  3077. {
  3078. $io = $this->getIO();
  3079. if (true === $result) {
  3080. $io->write('<info>OK</info>');
  3081. return;
  3082. }
  3083. $hadError = false;
  3084. $hadWarning = false;
  3085. if ($result instanceof \Exception) {
  3086. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  3087. }
  3088. if (!$result) {
  3089. $hadError = true;
  3090. } else {
  3091. if (!is_array($result)) {
  3092. $result = array($result);
  3093. }
  3094. foreach ($result as $message) {
  3095. if (false !== strpos($message, '<error>')) {
  3096. $hadError = true;
  3097. } elseif (false !== strpos($message, '<warning>')) {
  3098. $hadWarning = true;
  3099. }
  3100. }
  3101. }
  3102. if ($hadError) {
  3103. $io->write('<error>FAIL</error>');
  3104. $this->exitCode = max($this->exitCode, 2);
  3105. } elseif ($hadWarning) {
  3106. $io->write('<warning>WARNING</warning>');
  3107. $this->exitCode = max($this->exitCode, 1);
  3108. }
  3109. if ($result) {
  3110. foreach ($result as $message) {
  3111. $io->write($message);
  3112. }
  3113. }
  3114. }
  3115. private function checkPlatform()
  3116. {
  3117. $output = '';
  3118. $out = function ($msg, $style) use (&$output) {
  3119. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3120. };
  3121. $errors = array();
  3122. $warnings = array();
  3123. $displayIniMessage = false;
  3124. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3125. $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.';
  3126. if (!function_exists('json_decode')) {
  3127. $errors['json'] = true;
  3128. }
  3129. if (!extension_loaded('Phar')) {
  3130. $errors['phar'] = true;
  3131. }
  3132. if (!extension_loaded('filter')) {
  3133. $errors['filter'] = true;
  3134. }
  3135. if (!extension_loaded('hash')) {
  3136. $errors['hash'] = true;
  3137. }
  3138. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3139. $errors['iconv_mbstring'] = true;
  3140. }
  3141. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3142. $errors['allow_url_fopen'] = true;
  3143. }
  3144. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3145. $errors['ioncube'] = ioncube_loader_version();
  3146. }
  3147. if (PHP_VERSION_ID < 50302) {
  3148. $errors['php'] = PHP_VERSION;
  3149. }
  3150. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  3151. $warnings['php'] = PHP_VERSION;
  3152. }
  3153. if (!extension_loaded('openssl')) {
  3154. $errors['openssl'] = true;
  3155. }
  3156. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3157. $warnings['openssl_version'] = true;
  3158. }
  3159. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3160. $warnings['apc_cli'] = true;
  3161. }
  3162. if (!extension_loaded('zlib')) {
  3163. $warnings['zlib'] = true;
  3164. }
  3165. ob_start();
  3166. phpinfo(INFO_GENERAL);
  3167. $phpinfo = ob_get_clean();
  3168. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3169. $configure = $match[1];
  3170. if (false !== strpos($configure, '--enable-sigchild')) {
  3171. $warnings['sigchild'] = true;
  3172. }
  3173. if (false !== strpos($configure, '--with-curlwrappers')) {
  3174. $warnings['curlwrappers'] = true;
  3175. }
  3176. }
  3177. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3178. $warnings['xdebug_profile'] = true;
  3179. } elseif (extension_loaded('xdebug')) {
  3180. $warnings['xdebug_loaded'] = true;
  3181. }
  3182. if (defined('PHP_WINDOWS_VERSION_BUILD')
  3183. && (version_compare(PHP_VERSION, '7.2.23', '<')
  3184. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  3185. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  3186. $warnings['onedrive'] = PHP_VERSION;
  3187. }
  3188. if (!empty($errors)) {
  3189. foreach ($errors as $error => $current) {
  3190. switch ($error) {
  3191. case 'json':
  3192. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3193. $text .= "Install it or recompile php without --disable-json";
  3194. break;
  3195. case 'phar':
  3196. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3197. $text .= "Install it or recompile php without --disable-phar";
  3198. break;
  3199. case 'filter':
  3200. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3201. $text .= "Install it or recompile php without --disable-filter";
  3202. break;
  3203. case 'hash':
  3204. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3205. $text .= "Install it or recompile php without --disable-hash";
  3206. break;
  3207. case 'iconv_mbstring':
  3208. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3209. $text .= "Install either of them or recompile php without --disable-iconv";
  3210. break;
  3211. case 'unicode':
  3212. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3213. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3214. $text .= " detect_unicode = Off";
  3215. $displayIniMessage = true;
  3216. break;
  3217. case 'suhosin':
  3218. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3219. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  3220. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3221. $displayIniMessage = true;
  3222. break;
  3223. case 'php':
  3224. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3225. break;
  3226. case 'allow_url_fopen':
  3227. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3228. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3229. $text .= " allow_url_fopen = On";
  3230. $displayIniMessage = true;
  3231. break;
  3232. case 'ioncube':
  3233. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3234. $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;
  3235. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3236. $displayIniMessage = true;
  3237. break;
  3238. case 'openssl':
  3239. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3240. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3241. break;
  3242. }
  3243. $out($text, 'error');
  3244. }
  3245. $output .= PHP_EOL;
  3246. }
  3247. if (!empty($warnings)) {
  3248. foreach ($warnings as $warning => $current) {
  3249. switch ($warning) {
  3250. case 'apc_cli':
  3251. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3252. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3253. $text .= " apc.enable_cli = Off";
  3254. $displayIniMessage = true;
  3255. break;
  3256. case 'zlib':
  3257. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3258. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3259. $displayIniMessage = true;
  3260. break;
  3261. case 'sigchild':
  3262. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3263. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3264. $text .= " https://bugs.php.net/bug.php?id=22999";
  3265. break;
  3266. case 'curlwrappers':
  3267. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3268. $text .= " Recompile it without this flag if possible";
  3269. break;
  3270. case 'php':
  3271. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3272. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3273. break;
  3274. case 'openssl_version':
  3275. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3276. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3277. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3278. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3279. break;
  3280. case 'xdebug_loaded':
  3281. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3282. $text .= " Disabling it when using Composer is recommended.";
  3283. break;
  3284. case 'xdebug_profile':
  3285. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3286. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3287. $text .= " xdebug.profiler_enabled = 0";
  3288. $displayIniMessage = true;
  3289. break;
  3290. case 'onedrive':
  3291. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  3292. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  3293. break;
  3294. }
  3295. $out($text, 'comment');
  3296. }
  3297. }
  3298. if ($displayIniMessage) {
  3299. $out($iniMessage, 'comment');
  3300. }
  3301. return !$warnings && !$errors ? true : $output;
  3302. }
  3303. private function checkConnectivity()
  3304. {
  3305. if (!ini_get('allow_url_fopen')) {
  3306. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3307. return $result;
  3308. }
  3309. return true;
  3310. }
  3311. }
  3312. <?php
  3313. namespace Composer\Command;
  3314. use Composer\Plugin\CommandEvent;
  3315. use Composer\Plugin\PluginEvents;
  3316. use Symfony\Component\Console\Input\InputInterface;
  3317. use Symfony\Component\Console\Input\InputOption;
  3318. use Symfony\Component\Console\Output\OutputInterface;
  3319. class DumpAutoloadCommand extends BaseCommand
  3320. {
  3321. protected function configure()
  3322. {
  3323. $this
  3324. ->setName('dump-autoload')
  3325. ->setAliases(array('dumpautoload'))
  3326. ->setDescription('Dumps the autoloader.')
  3327. ->setDefinition(array(
  3328. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3329. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3330. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3331. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3332. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3333. ))
  3334. ->setHelp(
  3335. <<<EOT
  3336. <info>php composer.phar dump-autoload</info>
  3337. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3338. EOT
  3339. )
  3340. ;
  3341. }
  3342. protected function execute(InputInterface $input, OutputInterface $output)
  3343. {
  3344. $composer = $this->getComposer();
  3345. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3346. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3347. $installationManager = $composer->getInstallationManager();
  3348. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3349. $package = $composer->getPackage();
  3350. $config = $composer->getConfig();
  3351. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3352. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3353. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3354. if ($authoritative) {
  3355. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3356. } elseif ($optimize) {
  3357. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3358. } else {
  3359. $this->getIO()->write('<info>Generating autoload files</info>');
  3360. }
  3361. $generator = $composer->getAutoloadGenerator();
  3362. $generator->setDevMode(!$input->getOption('no-dev'));
  3363. $generator->setClassMapAuthoritative($authoritative);
  3364. $generator->setApcu($apcu);
  3365. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3366. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3367. if ($authoritative) {
  3368. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3369. } elseif ($optimize) {
  3370. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3371. } else {
  3372. $this->getIO()->write('<info>Generated autoload files</info>');
  3373. }
  3374. return 0;
  3375. }
  3376. }
  3377. <?php
  3378. namespace Composer\Command;
  3379. use Symfony\Component\Console\Input\InputInterface;
  3380. use Symfony\Component\Console\Input\InputOption;
  3381. use Symfony\Component\Console\Output\OutputInterface;
  3382. use Symfony\Component\Console\Input\InputArgument;
  3383. class ExecCommand extends BaseCommand
  3384. {
  3385. protected function configure()
  3386. {
  3387. $this
  3388. ->setName('exec')
  3389. ->setDescription('Executes a vendored binary/script.')
  3390. ->setDefinition(array(
  3391. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3392. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3393. new InputArgument(
  3394. 'args',
  3395. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3396. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3397. ),
  3398. ))
  3399. ->setHelp(
  3400. <<<EOT
  3401. Executes a vendored binary/script.
  3402. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3403. EOT
  3404. )
  3405. ;
  3406. }
  3407. protected function execute(InputInterface $input, OutputInterface $output)
  3408. {
  3409. $composer = $this->getComposer();
  3410. $binDir = $composer->getConfig()->get('bin-dir');
  3411. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3412. $bins = glob($binDir . '/*');
  3413. $bins = array_merge($bins, array_map(function ($e) {
  3414. return "$e (local)";
  3415. }, $composer->getPackage()->getBinaries()));
  3416. if (!$bins) {
  3417. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3418. }
  3419. $this->getIO()->write(
  3420. <<<EOT
  3421. <comment>Available binaries:</comment>
  3422. EOT
  3423. );
  3424. foreach ($bins as $bin) {
  3425. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3426. continue;
  3427. }
  3428. $previousBin = $bin;
  3429. $bin = basename($bin);
  3430. $this->getIO()->write(
  3431. <<<EOT
  3432. <info>- $bin</info>
  3433. EOT
  3434. );
  3435. }
  3436. return 0;
  3437. }
  3438. $binary = $input->getArgument('binary');
  3439. $dispatcher = $composer->getEventDispatcher();
  3440. $dispatcher->addListener('__exec_command', $binary);
  3441. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3442. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3443. }
  3444. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
  3445. try {
  3446. chdir($this->getApplication()->getInitialWorkingDirectory());
  3447. } catch (\Exception $e) {
  3448. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  3449. }
  3450. }
  3451. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3452. }
  3453. }
  3454. <?php
  3455. namespace Composer\Command;
  3456. use Composer\Package\CompletePackageInterface;
  3457. use Composer\Package\AliasPackage;
  3458. use Composer\Repository\CompositeRepository;
  3459. use Symfony\Component\Console\Input\InputInterface;
  3460. use Symfony\Component\Console\Input\InputOption;
  3461. use Symfony\Component\Console\Output\OutputInterface;
  3462. class FundCommand extends BaseCommand
  3463. {
  3464. protected function configure()
  3465. {
  3466. $this->setName('fund')
  3467. ->setDescription('Discover how to help fund the maintenance of your dependencies.')
  3468. ;
  3469. }
  3470. protected function execute(InputInterface $input, OutputInterface $output)
  3471. {
  3472. $composer = $this->getComposer();
  3473. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3474. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  3475. $fundings = array();
  3476. foreach ($repo->getPackages() as $package) {
  3477. if ($package instanceof AliasPackage) {
  3478. continue;
  3479. }
  3480. $latest = $remoteRepos->findPackage($package->getName(), 'dev-master');
  3481. if ($latest instanceof CompletePackageInterface && $latest->getFunding()) {
  3482. $fundings = $this->insertFundingData($fundings, $latest);
  3483. continue;
  3484. }
  3485. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  3486. $fundings = $this->insertFundingData($fundings, $package);
  3487. }
  3488. }
  3489. ksort($fundings);
  3490. $io = $this->getIO();
  3491. if ($fundings) {
  3492. $prev = null;
  3493. $io->write('The following packages were found in your dependencies which publish funding information:');
  3494. foreach ($fundings as $vendor => $links) {
  3495. $io->write('');
  3496. $io->write(sprintf("<comment>%s</comment>", $vendor));
  3497. foreach ($links as $url => $packages) {
  3498. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  3499. if ($prev !== $line) {
  3500. $io->write($line);
  3501. $prev = $line;
  3502. }
  3503. $io->write(sprintf(' %s', $url));
  3504. }
  3505. }
  3506. $io->write("");
  3507. $io->write("Please consider following these links and sponsoring the work of package authors!");
  3508. $io->write("Thank you!");
  3509. } else {
  3510. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  3511. }
  3512. return 0;
  3513. }
  3514. private function insertFundingData(array $fundings, CompletePackageInterface $package)
  3515. {
  3516. foreach ($package->getFunding() as $fundingOption) {
  3517. list($vendor, $packageName) = explode('/', $package->getPrettyName());
  3518. if (empty($fundingOption['url'])) {
  3519. continue;
  3520. }
  3521. $url = $fundingOption['url'];
  3522. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && preg_match('{^https://github.com/([^/]+)$}', $url, $match)) {
  3523. $url = 'https://github.com/sponsors/'.$match[1];
  3524. }
  3525. $fundings[$vendor][$url][] = $packageName;
  3526. }
  3527. return $fundings;
  3528. }
  3529. }
  3530. <?php
  3531. namespace Composer\Command;
  3532. use Composer\Factory;
  3533. use Composer\Util\Filesystem;
  3534. use Symfony\Component\Console\Input\InputInterface;
  3535. use Symfony\Component\Console\Input\InputArgument;
  3536. use Symfony\Component\Console\Input\StringInput;
  3537. use Symfony\Component\Console\Output\OutputInterface;
  3538. class GlobalCommand extends BaseCommand
  3539. {
  3540. protected function configure()
  3541. {
  3542. $this
  3543. ->setName('global')
  3544. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3545. ->setDefinition(array(
  3546. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3547. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3548. ))
  3549. ->setHelp(
  3550. <<<EOT
  3551. Use this command as a wrapper to run other Composer commands
  3552. within the global context of COMPOSER_HOME.
  3553. You can use this to install CLI utilities globally, all you need
  3554. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3555. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3556. and /home/<user>/.composer on unix systems.
  3557. If your system uses freedesktop.org standards, then it will first check
  3558. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3559. Note: This path may vary depending on customizations to bin-dir in
  3560. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3561. Read more at https://getcomposer.org/doc/03-cli.md#global
  3562. EOT
  3563. )
  3564. ;
  3565. }
  3566. public function run(InputInterface $input, OutputInterface $output)
  3567. {
  3568. $tokens = preg_split('{\s+}', $input->__toString());
  3569. $args = array();
  3570. foreach ($tokens as $token) {
  3571. if ($token && $token[0] !== '-') {
  3572. $args[] = $token;
  3573. if (count($args) >= 2) {
  3574. break;
  3575. }
  3576. }
  3577. }
  3578. if (count($args) < 2) {
  3579. return parent::run($input, $output);
  3580. }
  3581. $config = Factory::createConfig();
  3582. $home = $config->get('home');
  3583. if (!is_dir($home)) {
  3584. $fs = new Filesystem();
  3585. $fs->ensureDirectoryExists($home);
  3586. if (!is_dir($home)) {
  3587. throw new \RuntimeException('Could not create home directory');
  3588. }
  3589. }
  3590. try {
  3591. chdir($home);
  3592. } catch (\Exception $e) {
  3593. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3594. }
  3595. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3596. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3597. $this->getApplication()->resetComposer();
  3598. return $this->getApplication()->run($input, $output);
  3599. }
  3600. public function isProxyCommand()
  3601. {
  3602. return true;
  3603. }
  3604. }
  3605. <?php
  3606. namespace Composer\Command;
  3607. use Composer\Package\CompletePackageInterface;
  3608. use Composer\Repository\RepositoryInterface;
  3609. use Composer\Repository\ArrayRepository;
  3610. use Composer\Repository\RepositoryFactory;
  3611. use Composer\Util\Platform;
  3612. use Composer\Util\ProcessExecutor;
  3613. use Symfony\Component\Console\Input\InputArgument;
  3614. use Symfony\Component\Console\Input\InputOption;
  3615. use Symfony\Component\Console\Input\InputInterface;
  3616. use Symfony\Component\Console\Output\OutputInterface;
  3617. class HomeCommand extends BaseCommand
  3618. {
  3619. protected function configure()
  3620. {
  3621. $this
  3622. ->setName('browse')
  3623. ->setAliases(array('home'))
  3624. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3625. ->setDefinition(array(
  3626. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3627. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3628. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3629. ))
  3630. ->setHelp(
  3631. <<<EOT
  3632. The home command opens or shows a package's repository URL or
  3633. homepage in your default browser.
  3634. To open the homepage by default, use -H or --homepage.
  3635. To show instead of open the repository or homepage URL, use -s or --show.
  3636. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3637. EOT
  3638. );
  3639. }
  3640. protected function execute(InputInterface $input, OutputInterface $output)
  3641. {
  3642. $repos = $this->initializeRepos();
  3643. $io = $this->getIO();
  3644. $return = 0;
  3645. $packages = $input->getArgument('packages');
  3646. if (!$packages) {
  3647. $io->writeError('No package specified, opening homepage for the root package');
  3648. $packages = array($this->getComposer()->getPackage()->getName());
  3649. }
  3650. foreach ($packages as $packageName) {
  3651. $handled = false;
  3652. $packageExists = false;
  3653. foreach ($repos as $repo) {
  3654. foreach ($repo->findPackages($packageName) as $package) {
  3655. $packageExists = true;
  3656. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3657. $handled = true;
  3658. break 2;
  3659. }
  3660. }
  3661. }
  3662. if (!$packageExists) {
  3663. $return = 1;
  3664. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3665. }
  3666. if (!$handled) {
  3667. $return = 1;
  3668. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3669. }
  3670. }
  3671. return $return;
  3672. }
  3673. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3674. {
  3675. $support = $package->getSupport();
  3676. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3677. if (!$url || $showHomepage) {
  3678. $url = $package->getHomepage();
  3679. }
  3680. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3681. return false;
  3682. }
  3683. if ($showOnly) {
  3684. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3685. } else {
  3686. $this->openBrowser($url);
  3687. }
  3688. return true;
  3689. }
  3690. private function openBrowser($url)
  3691. {
  3692. $url = ProcessExecutor::escape($url);
  3693. $process = new ProcessExecutor($this->getIO());
  3694. if (Platform::isWindows()) {
  3695. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3696. }
  3697. $linux = $process->execute('which xdg-open', $output);
  3698. $osx = $process->execute('which open', $output);
  3699. if (0 === $linux) {
  3700. $process->execute('xdg-open ' . $url, $output);
  3701. } elseif (0 === $osx) {
  3702. $process->execute('open ' . $url, $output);
  3703. } else {
  3704. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3705. }
  3706. }
  3707. private function initializeRepos()
  3708. {
  3709. $composer = $this->getComposer(false);
  3710. if ($composer) {
  3711. return array_merge(
  3712. array(new ArrayRepository(array($composer->getPackage()))),
  3713. array($composer->getRepositoryManager()->getLocalRepository()),
  3714. $composer->getRepositoryManager()->getRepositories()
  3715. );
  3716. }
  3717. return RepositoryFactory::defaultRepos($this->getIO());
  3718. }
  3719. }
  3720. <?php
  3721. namespace Composer\Command;
  3722. use Composer\DependencyResolver\Pool;
  3723. use Composer\Factory;
  3724. use Composer\Json\JsonFile;
  3725. use Composer\Package\BasePackage;
  3726. use Composer\Package\Package;
  3727. use Composer\Package\Version\VersionParser;
  3728. use Composer\Package\Version\VersionSelector;
  3729. use Composer\Repository\CompositeRepository;
  3730. use Composer\Repository\PlatformRepository;
  3731. use Composer\Repository\RepositoryFactory;
  3732. use Composer\Util\ProcessExecutor;
  3733. use Symfony\Component\Console\Input\ArrayInput;
  3734. use Symfony\Component\Console\Input\InputInterface;
  3735. use Symfony\Component\Console\Input\InputOption;
  3736. use Symfony\Component\Console\Output\OutputInterface;
  3737. use Symfony\Component\Process\ExecutableFinder;
  3738. use Symfony\Component\Process\Process;
  3739. class InitCommand extends BaseCommand
  3740. {
  3741. protected $repos;
  3742. private $gitConfig;
  3743. private $pools;
  3744. protected function configure()
  3745. {
  3746. $this
  3747. ->setName('init')
  3748. ->setDescription('Creates a basic composer.json file in current directory.')
  3749. ->setDefinition(array(
  3750. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3751. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3752. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3753. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3754. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3755. 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"'),
  3756. 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"'),
  3757. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3758. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3759. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3760. ))
  3761. ->setHelp(
  3762. <<<EOT
  3763. The <info>init</info> command creates a basic composer.json file
  3764. in the current directory.
  3765. <info>php composer.phar init</info>
  3766. Read more at https://getcomposer.org/doc/03-cli.md#init
  3767. EOT
  3768. )
  3769. ;
  3770. }
  3771. protected function execute(InputInterface $input, OutputInterface $output)
  3772. {
  3773. $io = $this->getIO();
  3774. $allowList = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3775. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowList)));
  3776. if (isset($options['author'])) {
  3777. $options['authors'] = $this->formatAuthors($options['author']);
  3778. unset($options['author']);
  3779. }
  3780. $repositories = $input->getOption('repository');
  3781. if ($repositories) {
  3782. $config = Factory::createConfig($io);
  3783. foreach ($repositories as $repo) {
  3784. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3785. }
  3786. }
  3787. if (isset($options['stability'])) {
  3788. $options['minimum-stability'] = $options['stability'];
  3789. unset($options['stability']);
  3790. }
  3791. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3792. if (array() === $options['require']) {
  3793. $options['require'] = new \stdClass;
  3794. }
  3795. if (isset($options['require-dev'])) {
  3796. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3797. if (array() === $options['require-dev']) {
  3798. $options['require-dev'] = new \stdClass;
  3799. }
  3800. }
  3801. $file = new JsonFile(Factory::getComposerFile());
  3802. $json = $file->encode($options);
  3803. if ($input->isInteractive()) {
  3804. $io->writeError(array('', $json, ''));
  3805. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3806. $io->writeError('<error>Command aborted</error>');
  3807. return 1;
  3808. }
  3809. }
  3810. $file->write($options);
  3811. if ($input->isInteractive() && is_dir('.git')) {
  3812. $ignoreFile = realpath('.gitignore');
  3813. if (false === $ignoreFile) {
  3814. $ignoreFile = realpath('.') . '/.gitignore';
  3815. }
  3816. if (!$this->hasVendorIgnore($ignoreFile)) {
  3817. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3818. if ($io->askConfirmation($question, true)) {
  3819. $this->addVendorIgnore($ignoreFile);
  3820. }
  3821. }
  3822. }
  3823. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3824. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3825. $this->installDependencies($output);
  3826. }
  3827. return 0;
  3828. }
  3829. protected function interact(InputInterface $input, OutputInterface $output)
  3830. {
  3831. $git = $this->getGitConfig();
  3832. $io = $this->getIO();
  3833. $formatter = $this->getHelperSet()->get('formatter');
  3834. $repositories = $input->getOption('repository');
  3835. if ($repositories) {
  3836. $config = Factory::createConfig($io);
  3837. $repos = array(new PlatformRepository);
  3838. $createDefaultPackagistRepo = true;
  3839. foreach ($repositories as $repo) {
  3840. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3841. if (
  3842. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3843. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3844. ) {
  3845. $createDefaultPackagistRepo = false;
  3846. continue;
  3847. }
  3848. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3849. }
  3850. if ($createDefaultPackagistRepo) {
  3851. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3852. 'type' => 'composer',
  3853. 'url' => 'https://repo.packagist.org',
  3854. ));
  3855. }
  3856. $this->repos = new CompositeRepository($repos);
  3857. unset($repos, $config, $repositories);
  3858. }
  3859. $io->writeError(array(
  3860. '',
  3861. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3862. '',
  3863. ));
  3864. $io->writeError(array(
  3865. '',
  3866. 'This command will guide you through creating your composer.json config.',
  3867. '',
  3868. ));
  3869. $cwd = realpath(".");
  3870. if (!$name = $input->getOption('name')) {
  3871. $name = basename($cwd);
  3872. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3873. $name = strtolower($name);
  3874. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3875. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3876. } elseif (isset($git['github.user'])) {
  3877. $name = $git['github.user'] . '/' . $name;
  3878. } elseif (!empty($_SERVER['USERNAME'])) {
  3879. $name = $_SERVER['USERNAME'] . '/' . $name;
  3880. } elseif (!empty($_SERVER['USER'])) {
  3881. $name = $_SERVER['USER'] . '/' . $name;
  3882. } elseif (get_current_user()) {
  3883. $name = get_current_user() . '/' . $name;
  3884. } else {
  3885. $name .= '/' . $name;
  3886. }
  3887. $name = strtolower($name);
  3888. } else {
  3889. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3890. throw new \InvalidArgumentException(
  3891. 'The package name '.$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_.-]+'
  3892. );
  3893. }
  3894. }
  3895. $name = $io->askAndValidate(
  3896. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3897. function ($value) use ($name) {
  3898. if (null === $value) {
  3899. return $name;
  3900. }
  3901. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3902. throw new \InvalidArgumentException(
  3903. '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_.-]+'
  3904. );
  3905. }
  3906. return $value;
  3907. },
  3908. null,
  3909. $name
  3910. );
  3911. $input->setOption('name', $name);
  3912. $description = $input->getOption('description') ?: false;
  3913. $description = $io->ask(
  3914. 'Description [<comment>'.$description.'</comment>]: ',
  3915. $description
  3916. );
  3917. $input->setOption('description', $description);
  3918. if (null === $author = $input->getOption('author')) {
  3919. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3920. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3921. } elseif (isset($git['user.name'])) {
  3922. $author_name = $git['user.name'];
  3923. }
  3924. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3925. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3926. } elseif (isset($git['user.email'])) {
  3927. $author_email = $git['user.email'];
  3928. }
  3929. if (isset($author_name) && isset($author_email)) {
  3930. $author = sprintf('%s <%s>', $author_name, $author_email);
  3931. }
  3932. }
  3933. $self = $this;
  3934. $author = $io->askAndValidate(
  3935. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3936. function ($value) use ($self, $author) {
  3937. if ($value === 'n' || $value === 'no') {
  3938. return;
  3939. }
  3940. $value = $value ?: $author;
  3941. $author = $self->parseAuthorString($value);
  3942. return sprintf('%s <%s>', $author['name'], $author['email']);
  3943. },
  3944. null,
  3945. $author
  3946. );
  3947. $input->setOption('author', $author);
  3948. $minimumStability = $input->getOption('stability') ?: null;
  3949. $minimumStability = $io->askAndValidate(
  3950. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3951. function ($value) use ($minimumStability) {
  3952. if (null === $value) {
  3953. return $minimumStability;
  3954. }
  3955. if (!isset(BasePackage::$stabilities[$value])) {
  3956. throw new \InvalidArgumentException(
  3957. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3958. implode(', ', array_keys(BasePackage::$stabilities))
  3959. );
  3960. }
  3961. return $value;
  3962. },
  3963. null,
  3964. $minimumStability
  3965. );
  3966. $input->setOption('stability', $minimumStability);
  3967. $type = $input->getOption('type') ?: false;
  3968. $type = $io->ask(
  3969. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3970. $type
  3971. );
  3972. $input->setOption('type', $type);
  3973. if (null === $license = $input->getOption('license')) {
  3974. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3975. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3976. }
  3977. }
  3978. $license = $io->ask(
  3979. 'License [<comment>'.$license.'</comment>]: ',
  3980. $license
  3981. );
  3982. $input->setOption('license', $license);
  3983. $io->writeError(array('', 'Define your dependencies.', ''));
  3984. $repos = $this->getRepos();
  3985. $preferredStability = $minimumStability ?: 'stable';
  3986. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3987. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3988. $require = $input->getOption('require');
  3989. $requirements = array();
  3990. if ($require || $io->askConfirmation($question, true)) {
  3991. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3992. }
  3993. $input->setOption('require', $requirements);
  3994. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3995. $requireDev = $input->getOption('require-dev');
  3996. $devRequirements = array();
  3997. if ($requireDev || $io->askConfirmation($question, true)) {
  3998. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3999. }
  4000. $input->setOption('require-dev', $devRequirements);
  4001. }
  4002. public function parseAuthorString($author)
  4003. {
  4004. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  4005. if ($this->isValidEmail($match['email'])) {
  4006. return array(
  4007. 'name' => trim($match['name']),
  4008. 'email' => $match['email'],
  4009. );
  4010. }
  4011. }
  4012. throw new \InvalidArgumentException(
  4013. 'Invalid author string. Must be in the format: '.
  4014. 'John Smith <john@example.com>'
  4015. );
  4016. }
  4017. protected function findPackages($name)
  4018. {
  4019. return $this->getRepos()->search($name);
  4020. }
  4021. protected function getRepos()
  4022. {
  4023. if (!$this->repos) {
  4024. $this->repos = new CompositeRepository(array_merge(
  4025. array(new PlatformRepository),
  4026. RepositoryFactory::defaultRepos($this->getIO())
  4027. ));
  4028. }
  4029. return $this->repos;
  4030. }
  4031. final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
  4032. {
  4033. if ($requires) {
  4034. $requires = $this->normalizeRequirements($requires);
  4035. $result = array();
  4036. $io = $this->getIO();
  4037. foreach ($requires as $requirement) {
  4038. if (!isset($requirement['version'])) {
  4039. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, null, null, $fixed);
  4040. $requirement['version'] = $version;
  4041. $requirement['name'] = $name;
  4042. $io->writeError(sprintf(
  4043. 'Using version <info>%s</info> for <info>%s</info>',
  4044. $requirement['version'],
  4045. $requirement['name']
  4046. ));
  4047. } else {
  4048. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
  4049. $requirement['name'] = $name;
  4050. }
  4051. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  4052. }
  4053. return $result;
  4054. }
  4055. $versionParser = new VersionParser();
  4056. $composer = $this->getComposer(false);
  4057. $installedRepo = $composer ? $composer->getRepositoryManager()->getLocalRepository() : null;
  4058. $existingPackages = array();
  4059. if ($installedRepo) {
  4060. foreach ($installedRepo->getPackages() as $package) {
  4061. $existingPackages[] = $package->getName();
  4062. }
  4063. }
  4064. foreach ($requires as $requiredPackage) {
  4065. $existingPackages[] = substr($requiredPackage, 0, strpos($requiredPackage, ' '));
  4066. }
  4067. unset($composer, $installedRepo, $requiredPackage);
  4068. $io = $this->getIO();
  4069. while (null !== $package = $io->ask('Search for a package: ')) {
  4070. $matches = $this->findPackages($package);
  4071. if (count($matches)) {
  4072. foreach ($matches as $position => $foundPackage) {
  4073. if (in_array($foundPackage['name'], $existingPackages, true)) {
  4074. unset($matches[$position]);
  4075. }
  4076. }
  4077. $matches = array_values($matches);
  4078. $exactMatch = null;
  4079. $choices = array();
  4080. foreach ($matches as $position => $foundPackage) {
  4081. $abandoned = '';
  4082. if (isset($foundPackage['abandoned'])) {
  4083. if (is_string($foundPackage['abandoned'])) {
  4084. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  4085. } else {
  4086. $replacement = 'No replacement was suggested';
  4087. }
  4088. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  4089. }
  4090. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  4091. if ($foundPackage['name'] === $package) {
  4092. $exactMatch = true;
  4093. break;
  4094. }
  4095. }
  4096. if (!$exactMatch) {
  4097. $io->writeError(array(
  4098. '',
  4099. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  4100. '',
  4101. ));
  4102. $io->writeError($choices);
  4103. $io->writeError('');
  4104. $validator = function ($selection) use ($matches, $versionParser) {
  4105. if ('' === $selection) {
  4106. return false;
  4107. }
  4108. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  4109. $package = $matches[(int) $selection];
  4110. return $package['name'];
  4111. }
  4112. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  4113. if (isset($packageMatches['version'])) {
  4114. $versionParser->parseConstraints($packageMatches['version']);
  4115. return $packageMatches['name'].' '.$packageMatches['version'];
  4116. }
  4117. return $packageMatches['name'];
  4118. }
  4119. throw new \Exception('Not a valid selection');
  4120. };
  4121. $package = $io->askAndValidate(
  4122. 'Enter package # to add, or the complete package name if it is not listed: ',
  4123. $validator,
  4124. 3,
  4125. false
  4126. );
  4127. }
  4128. if (false !== $package && false === strpos($package, ' ')) {
  4129. $validator = function ($input) {
  4130. $input = trim($input);
  4131. return $input ?: false;
  4132. };
  4133. $constraint = $io->askAndValidate(
  4134. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  4135. $validator,
  4136. 3,
  4137. false
  4138. );
  4139. if (false === $constraint) {
  4140. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  4141. $io->writeError(sprintf(
  4142. 'Using version <info>%s</info> for <info>%s</info>',
  4143. $constraint,
  4144. $package
  4145. ));
  4146. }
  4147. $package .= ' '.$constraint;
  4148. }
  4149. if (false !== $package) {
  4150. $requires[] = $package;
  4151. $existingPackages[] = substr($package, 0, strpos($package, ' '));
  4152. }
  4153. }
  4154. }
  4155. return $requires;
  4156. }
  4157. protected function formatAuthors($author)
  4158. {
  4159. return array($this->parseAuthorString($author));
  4160. }
  4161. protected function formatRequirements(array $requirements)
  4162. {
  4163. $requires = array();
  4164. $requirements = $this->normalizeRequirements($requirements);
  4165. foreach ($requirements as $requirement) {
  4166. $requires[$requirement['name']] = $requirement['version'];
  4167. }
  4168. return $requires;
  4169. }
  4170. protected function getGitConfig()
  4171. {
  4172. if (null !== $this->gitConfig) {
  4173. return $this->gitConfig;
  4174. }
  4175. $finder = new ExecutableFinder();
  4176. $gitBin = $finder->find('git');
  4177. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  4178. $cmd = new Process(array($gitBin, 'config', '-l'));
  4179. } else {
  4180. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  4181. }
  4182. $cmd->run();
  4183. if ($cmd->isSuccessful()) {
  4184. $this->gitConfig = array();
  4185. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  4186. foreach ($matches as $match) {
  4187. $this->gitConfig[$match[1]] = $match[2];
  4188. }
  4189. return $this->gitConfig;
  4190. }
  4191. return $this->gitConfig = array();
  4192. }
  4193. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  4194. {
  4195. if (!file_exists($ignoreFile)) {
  4196. return false;
  4197. }
  4198. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  4199. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  4200. foreach ($lines as $line) {
  4201. if (preg_match($pattern, $line)) {
  4202. return true;
  4203. }
  4204. }
  4205. return false;
  4206. }
  4207. protected function normalizeRequirements(array $requirements)
  4208. {
  4209. $parser = new VersionParser();
  4210. return $parser->parseNameVersionPairs($requirements);
  4211. }
  4212. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  4213. {
  4214. $contents = "";
  4215. if (file_exists($ignoreFile)) {
  4216. $contents = file_get_contents($ignoreFile);
  4217. if ("\n" !== substr($contents, 0, -1)) {
  4218. $contents .= "\n";
  4219. }
  4220. }
  4221. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  4222. }
  4223. protected function isValidEmail($email)
  4224. {
  4225. if (!function_exists('filter_var')) {
  4226. return true;
  4227. }
  4228. if (PHP_VERSION_ID < 50303) {
  4229. return true;
  4230. }
  4231. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4232. }
  4233. private function getPool(InputInterface $input, $minimumStability = null)
  4234. {
  4235. $key = $minimumStability ?: 'default';
  4236. if (!isset($this->pools[$key])) {
  4237. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  4238. $pool->addRepository($this->getRepos());
  4239. }
  4240. return $this->pools[$key];
  4241. }
  4242. private function getMinimumStability(InputInterface $input)
  4243. {
  4244. if ($input->hasOption('stability')) {
  4245. return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable');
  4246. }
  4247. $file = Factory::getComposerFile();
  4248. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  4249. if (!empty($composer['minimum-stability'])) {
  4250. return VersionParser::normalizeStability($composer['minimum-stability']);
  4251. }
  4252. }
  4253. return 'stable';
  4254. }
  4255. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
  4256. {
  4257. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  4258. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  4259. if ($ignorePlatformReqs) {
  4260. $phpVersion = null;
  4261. }
  4262. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  4263. if (!$package) {
  4264. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  4265. return array($name, $requiredVersion ?: '*');
  4266. }
  4267. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  4268. throw new \InvalidArgumentException(sprintf(
  4269. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  4270. $name,
  4271. $requiredVersion,
  4272. $phpVersion
  4273. ));
  4274. }
  4275. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  4276. throw new \InvalidArgumentException(sprintf(
  4277. 'Could not find package %s in a version matching %s',
  4278. $name,
  4279. $requiredVersion
  4280. ));
  4281. }
  4282. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4283. throw new \InvalidArgumentException(sprintf(
  4284. 'Could not find package %s in any version matching your PHP version (%s)',
  4285. $name,
  4286. $phpVersion
  4287. ));
  4288. }
  4289. $similar = $this->findSimilar($name);
  4290. if ($similar) {
  4291. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4292. throw new \InvalidArgumentException(sprintf(
  4293. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4294. $name,
  4295. $this->getMinimumStability($input)
  4296. ));
  4297. }
  4298. throw new \InvalidArgumentException(sprintf(
  4299. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4300. $name,
  4301. implode("\n ", $similar)
  4302. ));
  4303. }
  4304. throw new \InvalidArgumentException(sprintf(
  4305. '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).',
  4306. $name,
  4307. $this->getMinimumStability($input)
  4308. ));
  4309. }
  4310. return array(
  4311. $package->getPrettyName(),
  4312. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  4313. );
  4314. }
  4315. private function findSimilar($package)
  4316. {
  4317. try {
  4318. $results = $this->repos->search($package);
  4319. } catch (\Exception $e) {
  4320. return array();
  4321. }
  4322. $similarPackages = array();
  4323. $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4324. foreach ($results as $result) {
  4325. if ($installedRepo->findPackage($result['name'], '*')) {
  4326. continue;
  4327. }
  4328. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4329. }
  4330. asort($similarPackages);
  4331. return array_keys(array_slice($similarPackages, 0, 5));
  4332. }
  4333. private function installDependencies($output)
  4334. {
  4335. try {
  4336. $installCommand = $this->getApplication()->find('install');
  4337. $installCommand->run(new ArrayInput(array()), $output);
  4338. } catch (\Exception $e) {
  4339. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4340. }
  4341. }
  4342. private function hasDependencies($options)
  4343. {
  4344. $requires = (array) $options['require'];
  4345. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4346. return !empty($requires) || !empty($devRequires);
  4347. }
  4348. }
  4349. <?php
  4350. namespace Composer\Command;
  4351. use Composer\Installer;
  4352. use Composer\Plugin\CommandEvent;
  4353. use Composer\Plugin\PluginEvents;
  4354. use Symfony\Component\Console\Input\InputInterface;
  4355. use Symfony\Component\Console\Input\InputOption;
  4356. use Symfony\Component\Console\Input\InputArgument;
  4357. use Symfony\Component\Console\Output\OutputInterface;
  4358. class InstallCommand extends BaseCommand
  4359. {
  4360. protected function configure()
  4361. {
  4362. $this
  4363. ->setName('install')
  4364. ->setAliases(array('i'))
  4365. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4366. ->setDefinition(array(
  4367. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4368. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4369. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4370. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4371. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4372. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4373. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4374. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4375. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4376. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4377. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4378. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4379. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4380. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4381. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4382. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4383. ))
  4384. ->setHelp(
  4385. <<<EOT
  4386. The <info>install</info> command reads the composer.lock file from
  4387. the current directory, processes it, and downloads and installs all the
  4388. libraries and dependencies outlined in that file. If the file does not
  4389. exist it will look for composer.json and do the same.
  4390. <info>php composer.phar install</info>
  4391. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4392. EOT
  4393. )
  4394. ;
  4395. }
  4396. protected function execute(InputInterface $input, OutputInterface $output)
  4397. {
  4398. $io = $this->getIO();
  4399. if ($args = $input->getArgument('packages')) {
  4400. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4401. return 1;
  4402. }
  4403. if ($input->getOption('no-custom-installers')) {
  4404. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4405. $input->setOption('no-plugins', true);
  4406. }
  4407. if ($input->getOption('dev')) {
  4408. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4409. }
  4410. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4411. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4412. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4413. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4414. $install = Installer::create($io, $composer);
  4415. $config = $composer->getConfig();
  4416. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4417. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4418. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4419. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4420. $install
  4421. ->setDryRun($input->getOption('dry-run'))
  4422. ->setVerbose($input->getOption('verbose'))
  4423. ->setPreferSource($preferSource)
  4424. ->setPreferDist($preferDist)
  4425. ->setDevMode(!$input->getOption('no-dev'))
  4426. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4427. ->setRunScripts(!$input->getOption('no-scripts'))
  4428. ->setSkipSuggest($input->getOption('no-suggest'))
  4429. ->setOptimizeAutoloader($optimize)
  4430. ->setClassMapAuthoritative($authoritative)
  4431. ->setApcuAutoloader($apcu)
  4432. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4433. ;
  4434. if ($input->getOption('no-plugins')) {
  4435. $install->disablePlugins();
  4436. }
  4437. return $install->run();
  4438. }
  4439. }
  4440. <?php
  4441. namespace Composer\Command;
  4442. use Composer\Json\JsonFile;
  4443. use Composer\Plugin\CommandEvent;
  4444. use Composer\Plugin\PluginEvents;
  4445. use Composer\Package\PackageInterface;
  4446. use Composer\Repository\RepositoryInterface;
  4447. use Symfony\Component\Console\Helper\Table;
  4448. use Symfony\Component\Console\Input\InputInterface;
  4449. use Symfony\Component\Console\Input\InputOption;
  4450. use Symfony\Component\Console\Output\OutputInterface;
  4451. class LicensesCommand extends BaseCommand
  4452. {
  4453. protected function configure()
  4454. {
  4455. $this
  4456. ->setName('licenses')
  4457. ->setDescription('Shows information about licenses of dependencies.')
  4458. ->setDefinition(array(
  4459. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4460. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4461. ))
  4462. ->setHelp(
  4463. <<<EOT
  4464. The license command displays detailed information about the licenses of
  4465. the installed dependencies.
  4466. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4467. EOT
  4468. )
  4469. ;
  4470. }
  4471. protected function execute(InputInterface $input, OutputInterface $output)
  4472. {
  4473. $composer = $this->getComposer();
  4474. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4475. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4476. $root = $composer->getPackage();
  4477. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4478. if ($input->getOption('no-dev')) {
  4479. $packages = $this->filterRequiredPackages($repo, $root);
  4480. } else {
  4481. $packages = $this->appendPackages($repo->getPackages(), array());
  4482. }
  4483. ksort($packages);
  4484. $io = $this->getIO();
  4485. switch ($format = $input->getOption('format')) {
  4486. case 'text':
  4487. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4488. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4489. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4490. $io->write('Dependencies:');
  4491. $io->write('');
  4492. $table = new Table($output);
  4493. $table->setStyle('compact');
  4494. $tableStyle = $table->getStyle();
  4495. if (method_exists($tableStyle, 'setVerticalBorderChars')) {
  4496. $tableStyle->setVerticalBorderChars('');
  4497. } else {
  4498. $tableStyle->setVerticalBorderChar('');
  4499. }
  4500. $tableStyle->setCellRowContentFormat('%s ');
  4501. $table->setHeaders(array('Name', 'Version', 'License'));
  4502. foreach ($packages as $package) {
  4503. $table->addRow(array(
  4504. $package->getPrettyName(),
  4505. $package->getFullPrettyVersion(),
  4506. implode(', ', $package->getLicense()) ?: 'none',
  4507. ));
  4508. }
  4509. $table->render();
  4510. break;
  4511. case 'json':
  4512. $dependencies = array();
  4513. foreach ($packages as $package) {
  4514. $dependencies[$package->getPrettyName()] = array(
  4515. 'version' => $package->getFullPrettyVersion(),
  4516. 'license' => $package->getLicense(),
  4517. );
  4518. }
  4519. $io->write(JsonFile::encode(array(
  4520. 'name' => $root->getPrettyName(),
  4521. 'version' => $root->getFullPrettyVersion(),
  4522. 'license' => $root->getLicense(),
  4523. 'dependencies' => $dependencies,
  4524. )));
  4525. break;
  4526. default:
  4527. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4528. }
  4529. return 0;
  4530. }
  4531. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4532. {
  4533. $requires = array_keys($package->getRequires());
  4534. $packageListNames = array_keys($bucket);
  4535. $packages = array_filter(
  4536. $repo->getPackages(),
  4537. function ($package) use ($requires, $packageListNames) {
  4538. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4539. }
  4540. );
  4541. $bucket = $this->appendPackages($packages, $bucket);
  4542. foreach ($packages as $package) {
  4543. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4544. }
  4545. return $bucket;
  4546. }
  4547. public function appendPackages(array $packages, array $bucket)
  4548. {
  4549. foreach ($packages as $package) {
  4550. $bucket[$package->getName()] = $package;
  4551. }
  4552. return $bucket;
  4553. }
  4554. }
  4555. <?php
  4556. namespace Composer\Command;
  4557. use Symfony\Component\Console\Input\InputInterface;
  4558. use Symfony\Component\Console\Input\InputArgument;
  4559. use Symfony\Component\Console\Input\ArrayInput;
  4560. use Symfony\Component\Console\Input\InputOption;
  4561. use Symfony\Component\Console\Output\OutputInterface;
  4562. class OutdatedCommand extends ShowCommand
  4563. {
  4564. protected function configure()
  4565. {
  4566. $this
  4567. ->setName('outdated')
  4568. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4569. ->setDefinition(array(
  4570. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4571. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4572. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4573. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4574. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4575. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4576. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4577. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4578. ))
  4579. ->setHelp(
  4580. <<<EOT
  4581. The outdated command is just a proxy for `composer show -l`
  4582. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4583. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4584. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4585. compatibility breaks according to semver, so upgrade when you can but it
  4586. may involve work.
  4587. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4588. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4589. EOT
  4590. )
  4591. ;
  4592. }
  4593. protected function execute(InputInterface $input, OutputInterface $output)
  4594. {
  4595. $args = array(
  4596. 'command' => 'show',
  4597. '--latest' => true,
  4598. );
  4599. if (!$input->getOption('all')) {
  4600. $args['--outdated'] = true;
  4601. }
  4602. if ($input->getOption('direct')) {
  4603. $args['--direct'] = true;
  4604. }
  4605. if ($input->getArgument('package')) {
  4606. $args['package'] = $input->getArgument('package');
  4607. }
  4608. if ($input->getOption('strict')) {
  4609. $args['--strict'] = true;
  4610. }
  4611. if ($input->getOption('minor-only')) {
  4612. $args['--minor-only'] = true;
  4613. }
  4614. $args['--format'] = $input->getOption('format');
  4615. $args['--ignore'] = $input->getOption('ignore');
  4616. $input = new ArrayInput($args);
  4617. return $this->getApplication()->run($input, $output);
  4618. }
  4619. public function isProxyCommand()
  4620. {
  4621. return true;
  4622. }
  4623. }
  4624. <?php
  4625. namespace Composer\Command;
  4626. use Symfony\Component\Console\Input\InputInterface;
  4627. use Symfony\Component\Console\Output\OutputInterface;
  4628. class ProhibitsCommand extends BaseDependencyCommand
  4629. {
  4630. protected function configure()
  4631. {
  4632. parent::configure();
  4633. $this
  4634. ->setName('prohibits')
  4635. ->setAliases(array('why-not'))
  4636. ->setDescription('Shows which packages prevent the given package from being installed.')
  4637. ->setHelp(
  4638. <<<EOT
  4639. Displays detailed information about why a package cannot be installed.
  4640. <info>php composer.phar prohibits composer/composer</info>
  4641. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4642. EOT
  4643. )
  4644. ;
  4645. }
  4646. protected function execute(InputInterface $input, OutputInterface $output)
  4647. {
  4648. return parent::doExecute($input, $output, true);
  4649. }
  4650. }
  4651. <?php
  4652. namespace Composer\Command;
  4653. use Composer\Config\JsonConfigSource;
  4654. use Composer\Installer;
  4655. use Composer\Plugin\CommandEvent;
  4656. use Composer\Plugin\PluginEvents;
  4657. use Composer\Json\JsonFile;
  4658. use Composer\Factory;
  4659. use Symfony\Component\Console\Input\InputInterface;
  4660. use Symfony\Component\Console\Input\InputOption;
  4661. use Symfony\Component\Console\Input\InputArgument;
  4662. use Symfony\Component\Console\Output\OutputInterface;
  4663. use Composer\Package\BasePackage;
  4664. class RemoveCommand extends BaseCommand
  4665. {
  4666. protected function configure()
  4667. {
  4668. $this
  4669. ->setName('remove')
  4670. ->setDescription('Removes a package from the require or require-dev.')
  4671. ->setDefinition(array(
  4672. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4673. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4674. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4675. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4676. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4677. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4678. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4679. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4680. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4681. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4682. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4683. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4684. ))
  4685. ->setHelp(
  4686. <<<EOT
  4687. The <info>remove</info> command removes a package from the current
  4688. list of installed packages
  4689. <info>php composer.phar remove</info>
  4690. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4691. EOT
  4692. )
  4693. ;
  4694. }
  4695. protected function execute(InputInterface $input, OutputInterface $output)
  4696. {
  4697. $packages = $input->getArgument('packages');
  4698. $packages = array_map('strtolower', $packages);
  4699. $file = Factory::getComposerFile();
  4700. $jsonFile = new JsonFile($file);
  4701. $composer = $jsonFile->read();
  4702. $composerBackup = file_get_contents($jsonFile->getPath());
  4703. $json = new JsonConfigSource($jsonFile);
  4704. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4705. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4706. $io = $this->getIO();
  4707. if ($input->getOption('update-with-dependencies')) {
  4708. $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>');
  4709. }
  4710. foreach (array('require', 'require-dev') as $linkType) {
  4711. if (isset($composer[$linkType])) {
  4712. foreach ($composer[$linkType] as $name => $version) {
  4713. $composer[$linkType][strtolower($name)] = $name;
  4714. }
  4715. }
  4716. }
  4717. foreach ($packages as $package) {
  4718. if (isset($composer[$type][$package])) {
  4719. $json->removeLink($type, $composer[$type][$package]);
  4720. } elseif (isset($composer[$altType][$package])) {
  4721. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4722. if ($io->isInteractive()) {
  4723. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4724. $json->removeLink($altType, $composer[$altType][$package]);
  4725. }
  4726. }
  4727. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4728. foreach ($matches as $matchedPackage) {
  4729. $json->removeLink($type, $matchedPackage);
  4730. }
  4731. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4732. foreach ($matches as $matchedPackage) {
  4733. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4734. if ($io->isInteractive()) {
  4735. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4736. $json->removeLink($altType, $matchedPackage);
  4737. }
  4738. }
  4739. }
  4740. } else {
  4741. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4742. }
  4743. }
  4744. if ($input->getOption('no-update')) {
  4745. return 0;
  4746. }
  4747. $this->resetComposer();
  4748. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4749. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4750. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4751. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4752. $install = Installer::create($io, $composer);
  4753. $updateDevMode = !$input->getOption('update-no-dev');
  4754. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4755. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4756. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4757. $install
  4758. ->setVerbose($input->getOption('verbose'))
  4759. ->setDevMode($updateDevMode)
  4760. ->setOptimizeAutoloader($optimize)
  4761. ->setClassMapAuthoritative($authoritative)
  4762. ->setApcuAutoloader($apcu)
  4763. ->setUpdate(true)
  4764. ->setUpdateAllowList($packages)
  4765. ->setAllowListTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4766. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4767. ->setRunScripts(!$input->getOption('no-scripts'))
  4768. ;
  4769. $status = $install->run();
  4770. if ($status !== 0) {
  4771. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4772. file_put_contents($jsonFile->getPath(), $composerBackup);
  4773. }
  4774. return $status;
  4775. }
  4776. }
  4777. <?php
  4778. namespace Composer\Command;
  4779. use Symfony\Component\Console\Input\InputInterface;
  4780. use Symfony\Component\Console\Input\InputArgument;
  4781. use Symfony\Component\Console\Input\InputOption;
  4782. use Symfony\Component\Console\Output\OutputInterface;
  4783. use Composer\Factory;
  4784. use Composer\Installer;
  4785. use Composer\Json\JsonFile;
  4786. use Composer\Json\JsonManipulator;
  4787. use Composer\Package\Version\VersionParser;
  4788. use Composer\Plugin\CommandEvent;
  4789. use Composer\Plugin\PluginEvents;
  4790. use Composer\Repository\CompositeRepository;
  4791. use Composer\Repository\PlatformRepository;
  4792. use Composer\IO\IOInterface;
  4793. use Composer\Util\Silencer;
  4794. class RequireCommand extends InitCommand
  4795. {
  4796. private $newlyCreated;
  4797. private $json;
  4798. private $file;
  4799. private $composerBackup;
  4800. protected function configure()
  4801. {
  4802. $this
  4803. ->setName('require')
  4804. ->setDescription('Adds required packages to your composer.json and installs them.')
  4805. ->setDefinition(array(
  4806. 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"'),
  4807. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4808. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4809. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4810. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  4811. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4812. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4813. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4814. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4815. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4816. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4817. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4818. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4819. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4820. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4821. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4822. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4823. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4824. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4825. ))
  4826. ->setHelp(
  4827. <<<EOT
  4828. The require command adds required packages to your composer.json and installs them.
  4829. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4830. matches to require.
  4831. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4832. If you do not want to install the new dependencies immediately you can call it with --no-update
  4833. Read more at https://getcomposer.org/doc/03-cli.md#require
  4834. EOT
  4835. )
  4836. ;
  4837. }
  4838. protected function execute(InputInterface $input, OutputInterface $output)
  4839. {
  4840. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  4841. pcntl_async_signals(true);
  4842. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4843. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4844. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4845. }
  4846. $this->file = Factory::getComposerFile();
  4847. $io = $this->getIO();
  4848. $this->newlyCreated = !file_exists($this->file);
  4849. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4850. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4851. return 1;
  4852. }
  4853. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4854. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4855. return 1;
  4856. }
  4857. if (filesize($this->file) === 0) {
  4858. file_put_contents($this->file, "{\n}\n");
  4859. }
  4860. $this->json = new JsonFile($this->file);
  4861. $this->composerBackup = file_get_contents($this->json->getPath());
  4862. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4863. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4864. return 1;
  4865. }
  4866. if ($input->getOption('fixed') === true) {
  4867. $config = $this->json->read();
  4868. $packageType = empty($config['type']) ? 'library' : $config['type'];
  4869. if ($packageType !== 'project') {
  4870. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  4871. if (empty($config['type'])) {
  4872. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  4873. }
  4874. return 1;
  4875. }
  4876. }
  4877. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4878. $repos = $composer->getRepositoryManager()->getRepositories();
  4879. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4880. $this->repos = new CompositeRepository(array_merge(
  4881. array(new PlatformRepository(array(), $platformOverrides)),
  4882. $repos
  4883. ));
  4884. if ($composer->getPackage()->getPreferStable()) {
  4885. $preferredStability = 'stable';
  4886. } else {
  4887. $preferredStability = $composer->getPackage()->getMinimumStability();
  4888. }
  4889. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4890. try {
  4891. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'), $input->getOption('fixed'));
  4892. } catch (\Exception $e) {
  4893. if ($this->newlyCreated) {
  4894. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4895. }
  4896. throw $e;
  4897. }
  4898. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4899. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4900. $requirements = $this->formatRequirements($requirements);
  4901. $versionParser = new VersionParser();
  4902. foreach ($requirements as $package => $constraint) {
  4903. if (strtolower($package) === $composer->getPackage()->getName()) {
  4904. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4905. return 1;
  4906. }
  4907. $versionParser->parseConstraints($constraint);
  4908. }
  4909. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4910. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4911. $composerDefinition = $this->json->read();
  4912. foreach ($requirements as $package => $version) {
  4913. $composerDefinition[$requireKey][$package] = $version;
  4914. unset($composerDefinition[$removeKey][$package]);
  4915. }
  4916. $this->json->write($composerDefinition);
  4917. }
  4918. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4919. if ($input->getOption('no-update')) {
  4920. return 0;
  4921. }
  4922. try {
  4923. return $this->doUpdate($input, $output, $io, $requirements);
  4924. } catch (\Exception $e) {
  4925. $this->revertComposerFile(false);
  4926. throw $e;
  4927. }
  4928. }
  4929. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4930. {
  4931. $this->resetComposer();
  4932. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4933. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4934. $updateDevMode = !$input->getOption('update-no-dev');
  4935. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4936. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4937. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4938. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4939. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4940. $install = Installer::create($io, $composer);
  4941. $install
  4942. ->setVerbose($input->getOption('verbose'))
  4943. ->setPreferSource($input->getOption('prefer-source'))
  4944. ->setPreferDist($input->getOption('prefer-dist'))
  4945. ->setDevMode($updateDevMode)
  4946. ->setRunScripts(!$input->getOption('no-scripts'))
  4947. ->setSkipSuggest($input->getOption('no-suggest'))
  4948. ->setOptimizeAutoloader($optimize)
  4949. ->setClassMapAuthoritative($authoritative)
  4950. ->setApcuAutoloader($apcu)
  4951. ->setUpdate(true)
  4952. ->setUpdateAllowList(array_keys($requirements))
  4953. ->setAllowListTransitiveDependencies($input->getOption('update-with-dependencies'))
  4954. ->setAllowListAllDependencies($input->getOption('update-with-all-dependencies'))
  4955. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4956. ->setPreferStable($input->getOption('prefer-stable'))
  4957. ->setPreferLowest($input->getOption('prefer-lowest'))
  4958. ;
  4959. $status = $install->run();
  4960. if ($status !== 0) {
  4961. $this->revertComposerFile(false);
  4962. }
  4963. return $status;
  4964. }
  4965. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4966. {
  4967. $contents = file_get_contents($json->getPath());
  4968. $manipulator = new JsonManipulator($contents);
  4969. foreach ($new as $package => $constraint) {
  4970. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4971. return false;
  4972. }
  4973. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4974. return false;
  4975. }
  4976. }
  4977. file_put_contents($json->getPath(), $manipulator->getContents());
  4978. return true;
  4979. }
  4980. protected function interact(InputInterface $input, OutputInterface $output)
  4981. {
  4982. return;
  4983. }
  4984. public function revertComposerFile($hardExit = true)
  4985. {
  4986. $io = $this->getIO();
  4987. if ($this->newlyCreated) {
  4988. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4989. unlink($this->json->getPath());
  4990. } else {
  4991. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4992. file_put_contents($this->json->getPath(), $this->composerBackup);
  4993. }
  4994. if ($hardExit) {
  4995. exit(1);
  4996. }
  4997. }
  4998. }
  4999. <?php
  5000. namespace Composer\Command;
  5001. use Composer\Script\Event as ScriptEvent;
  5002. use Composer\Script\ScriptEvents;
  5003. use Composer\Util\ProcessExecutor;
  5004. use Symfony\Component\Console\Input\InputInterface;
  5005. use Symfony\Component\Console\Input\InputOption;
  5006. use Symfony\Component\Console\Input\InputArgument;
  5007. use Symfony\Component\Console\Output\OutputInterface;
  5008. use Symfony\Component\Console\Helper\Table;
  5009. class RunScriptCommand extends BaseCommand
  5010. {
  5011. protected $scriptEvents = array(
  5012. ScriptEvents::PRE_INSTALL_CMD,
  5013. ScriptEvents::POST_INSTALL_CMD,
  5014. ScriptEvents::PRE_UPDATE_CMD,
  5015. ScriptEvents::POST_UPDATE_CMD,
  5016. ScriptEvents::PRE_STATUS_CMD,
  5017. ScriptEvents::POST_STATUS_CMD,
  5018. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  5019. ScriptEvents::POST_CREATE_PROJECT_CMD,
  5020. ScriptEvents::PRE_ARCHIVE_CMD,
  5021. ScriptEvents::POST_ARCHIVE_CMD,
  5022. ScriptEvents::PRE_AUTOLOAD_DUMP,
  5023. ScriptEvents::POST_AUTOLOAD_DUMP,
  5024. );
  5025. protected function configure()
  5026. {
  5027. $this
  5028. ->setName('run-script')
  5029. ->setAliases(array('run'))
  5030. ->setDescription('Runs the scripts defined in composer.json.')
  5031. ->setDefinition(array(
  5032. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  5033. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5034. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  5035. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5036. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5037. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  5038. ))
  5039. ->setHelp(
  5040. <<<EOT
  5041. The <info>run-script</info> command runs scripts defined in composer.json:
  5042. <info>php composer.phar run-script post-update-cmd</info>
  5043. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5044. EOT
  5045. )
  5046. ;
  5047. }
  5048. protected function execute(InputInterface $input, OutputInterface $output)
  5049. {
  5050. if ($input->getOption('list')) {
  5051. return $this->listScripts($output);
  5052. } elseif (!$input->getArgument('script')) {
  5053. throw new \RuntimeException('Missing required argument "script"');
  5054. }
  5055. $script = $input->getArgument('script');
  5056. if (!in_array($script, $this->scriptEvents)) {
  5057. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  5058. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  5059. }
  5060. }
  5061. $composer = $this->getComposer();
  5062. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  5063. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  5064. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  5065. if (!$hasListeners) {
  5066. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  5067. }
  5068. $args = $input->getArgument('args');
  5069. if (null !== $timeout = $input->getOption('timeout')) {
  5070. if (!ctype_digit($timeout)) {
  5071. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  5072. }
  5073. ProcessExecutor::setTimeout((int) $timeout);
  5074. }
  5075. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  5076. }
  5077. protected function listScripts(OutputInterface $output)
  5078. {
  5079. $scripts = $this->getComposer()->getPackage()->getScripts();
  5080. if (!count($scripts)) {
  5081. return 0;
  5082. }
  5083. $io = $this->getIO();
  5084. $io->writeError('<info>scripts:</info>');
  5085. $table = array();
  5086. foreach ($scripts as $name => $script) {
  5087. $description = '';
  5088. try {
  5089. $cmd = $this->getApplication()->find($name);
  5090. if ($cmd instanceof ScriptAliasCommand) {
  5091. $description = $cmd->getDescription();
  5092. }
  5093. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  5094. }
  5095. $table[] = array(' '.$name, $description);
  5096. }
  5097. $renderer = new Table($output);
  5098. $renderer->setStyle('compact');
  5099. $rendererStyle = $renderer->getStyle();
  5100. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  5101. $rendererStyle->setVerticalBorderChars('');
  5102. } else {
  5103. $rendererStyle->setVerticalBorderChar('');
  5104. }
  5105. $rendererStyle->setCellRowContentFormat('%s ');
  5106. $renderer->setRows($table)->render();
  5107. return 0;
  5108. }
  5109. }
  5110. <?php
  5111. namespace Composer\Command;
  5112. use Symfony\Component\Console\Input\InputInterface;
  5113. use Symfony\Component\Console\Input\InputOption;
  5114. use Symfony\Component\Console\Input\InputArgument;
  5115. use Symfony\Component\Console\Output\OutputInterface;
  5116. class ScriptAliasCommand extends BaseCommand
  5117. {
  5118. private $script;
  5119. private $description;
  5120. public function __construct($script, $description)
  5121. {
  5122. $this->script = $script;
  5123. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  5124. parent::__construct();
  5125. }
  5126. protected function configure()
  5127. {
  5128. $this
  5129. ->setName($this->script)
  5130. ->setDescription($this->description)
  5131. ->setDefinition(array(
  5132. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5133. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5134. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5135. ))
  5136. ->setHelp(
  5137. <<<EOT
  5138. The <info>run-script</info> command runs scripts defined in composer.json:
  5139. <info>php composer.phar run-script post-update-cmd</info>
  5140. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5141. EOT
  5142. )
  5143. ;
  5144. }
  5145. protected function execute(InputInterface $input, OutputInterface $output)
  5146. {
  5147. $composer = $this->getComposer();
  5148. $args = $input->getArguments();
  5149. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  5150. }
  5151. }
  5152. <?php
  5153. namespace Composer\Command;
  5154. use Composer\Factory;
  5155. use Symfony\Component\Console\Input\InputInterface;
  5156. use Symfony\Component\Console\Input\InputArgument;
  5157. use Symfony\Component\Console\Input\InputOption;
  5158. use Symfony\Component\Console\Output\OutputInterface;
  5159. use Composer\Repository\CompositeRepository;
  5160. use Composer\Repository\PlatformRepository;
  5161. use Composer\Repository\RepositoryInterface;
  5162. use Composer\Plugin\CommandEvent;
  5163. use Composer\Plugin\PluginEvents;
  5164. class SearchCommand extends BaseCommand
  5165. {
  5166. protected $matches;
  5167. protected $lowMatches = array();
  5168. protected $tokens;
  5169. protected $output;
  5170. protected $onlyName;
  5171. protected function configure()
  5172. {
  5173. $this
  5174. ->setName('search')
  5175. ->setDescription('Searches for packages.')
  5176. ->setDefinition(array(
  5177. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  5178. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  5179. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  5180. ))
  5181. ->setHelp(
  5182. <<<EOT
  5183. The search command searches for packages by its name
  5184. <info>php composer.phar search symfony composer</info>
  5185. Read more at https://getcomposer.org/doc/03-cli.md#search
  5186. EOT
  5187. )
  5188. ;
  5189. }
  5190. protected function execute(InputInterface $input, OutputInterface $output)
  5191. {
  5192. $platformRepo = new PlatformRepository;
  5193. $io = $this->getIO();
  5194. if (!($composer = $this->getComposer(false))) {
  5195. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  5196. }
  5197. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5198. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5199. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5200. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  5201. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5202. $onlyName = $input->getOption('only-name');
  5203. $type = $input->getOption('type') ?: null;
  5204. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  5205. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  5206. foreach ($results as $result) {
  5207. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  5208. }
  5209. return 0;
  5210. }
  5211. }
  5212. <?php
  5213. namespace Composer\Command;
  5214. use Composer\Composer;
  5215. use Composer\Factory;
  5216. use Composer\Config;
  5217. use Composer\Util\Filesystem;
  5218. use Composer\Util\Platform;
  5219. use Composer\SelfUpdate\Keys;
  5220. use Composer\SelfUpdate\Versions;
  5221. use Composer\IO\IOInterface;
  5222. use Composer\Downloader\FilesystemException;
  5223. use Symfony\Component\Console\Input\InputInterface;
  5224. use Symfony\Component\Console\Input\InputOption;
  5225. use Symfony\Component\Console\Input\InputArgument;
  5226. use Symfony\Component\Console\Output\OutputInterface;
  5227. use Symfony\Component\Finder\Finder;
  5228. class SelfUpdateCommand extends BaseCommand
  5229. {
  5230. const HOMEPAGE = 'getcomposer.org';
  5231. const OLD_INSTALL_EXT = '-old.phar';
  5232. protected function configure()
  5233. {
  5234. $this
  5235. ->setName('self-update')
  5236. ->setAliases(array('selfupdate'))
  5237. ->setDescription('Updates composer.phar to the latest version.')
  5238. ->setDefinition(array(
  5239. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  5240. 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'),
  5241. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  5242. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5243. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  5244. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  5245. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  5246. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  5247. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  5248. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  5249. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  5250. ))
  5251. ->setHelp(
  5252. <<<EOT
  5253. The <info>self-update</info> command checks getcomposer.org for newer
  5254. versions of composer and if found, installs the latest.
  5255. <info>php composer.phar self-update</info>
  5256. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  5257. EOT
  5258. )
  5259. ;
  5260. }
  5261. protected function execute(InputInterface $input, OutputInterface $output)
  5262. {
  5263. $config = Factory::createConfig();
  5264. if ($config->get('disable-tls') === true) {
  5265. $baseUrl = 'http://' . self::HOMEPAGE;
  5266. } else {
  5267. $baseUrl = 'https://' . self::HOMEPAGE;
  5268. }
  5269. $io = $this->getIO();
  5270. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  5271. $versionsUtil = new Versions($config, $remoteFilesystem);
  5272. $requestedChannel = null;
  5273. foreach (Versions::$channels as $channel) {
  5274. if ($input->getOption($channel)) {
  5275. $requestedChannel = $channel;
  5276. $versionsUtil->setChannel($channel);
  5277. break;
  5278. }
  5279. }
  5280. if ($input->getOption('set-channel-only')) {
  5281. return 0;
  5282. }
  5283. $cacheDir = $config->get('cache-dir');
  5284. $rollbackDir = $config->get('data-dir');
  5285. $home = $config->get('home');
  5286. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  5287. if ($input->getOption('update-keys')) {
  5288. return $this->fetchKeys($io, $config);
  5289. }
  5290. if (!file_exists($localFilename)) {
  5291. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  5292. }
  5293. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  5294. if (!is_writable($tmpDir)) {
  5295. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  5296. }
  5297. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  5298. $composeUser = posix_getpwuid(posix_geteuid());
  5299. $homeOwner = posix_getpwuid(fileowner($home));
  5300. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  5301. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  5302. }
  5303. }
  5304. if ($input->getOption('rollback')) {
  5305. return $this->rollback($output, $rollbackDir, $localFilename);
  5306. }
  5307. $latest = $versionsUtil->getLatest();
  5308. $latestStable = $versionsUtil->getLatest('stable');
  5309. try {
  5310. $latestPreview = $versionsUtil->getLatest('preview');
  5311. } catch (\UnexpectedValueException $e) {
  5312. $latestPreview = $latestStable;
  5313. }
  5314. $latestVersion = $latest['version'];
  5315. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  5316. $currentMajorVersion = preg_replace('{^(\d+).*}', '$1', Composer::getVersion());
  5317. $updateMajorVersion = preg_replace('{^(\d+).*}', '$1', $updateVersion);
  5318. $previewMajorVersion = preg_replace('{^(\d+).*}', '$1', $latestPreview['version']);
  5319. if ($versionsUtil->getChannel() === 'stable' && !$input->getArgument('version')) {
  5320. if ($currentMajorVersion < $updateMajorVersion) {
  5321. $skippedVersion = $updateVersion;
  5322. $versionsUtil->setChannel($currentMajorVersion);
  5323. $latest = $versionsUtil->getLatest();
  5324. $latestStable = $versionsUtil->getLatest('stable');
  5325. $latestVersion = $latest['version'];
  5326. $updateVersion = $latestVersion;
  5327. $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://github.com/composer/composer/releases for changelogs.</warning>');
  5328. } elseif ($currentMajorVersion < $previewMajorVersion) {
  5329. $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>');
  5330. }
  5331. }
  5332. if ($requestedChannel && is_numeric($requestedChannel) && substr($latestStable['version'], 0, 1) !== $requestedChannel) {
  5333. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$requestedChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  5334. }
  5335. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  5336. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  5337. return 1;
  5338. }
  5339. if (Composer::VERSION === $updateVersion) {
  5340. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5341. if ($input->getOption('clean-backups')) {
  5342. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5343. }
  5344. return 0;
  5345. }
  5346. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5347. $backupFile = sprintf(
  5348. '%s/%s-%s%s',
  5349. $rollbackDir,
  5350. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5351. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5352. self::OLD_INSTALL_EXT
  5353. );
  5354. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5355. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5356. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5357. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5358. $io->writeError(' ', false);
  5359. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5360. $io->writeError('');
  5361. if (!file_exists($tempFilename) || !$signature) {
  5362. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5363. return 1;
  5364. }
  5365. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5366. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5367. } else {
  5368. if (!extension_loaded('openssl')) {
  5369. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5370. . '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.');
  5371. }
  5372. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5373. if (!file_exists($sigFile)) {
  5374. file_put_contents(
  5375. $home.'/keys.dev.pub',
  5376. <<<DEVPUBKEY
  5377. -----BEGIN PUBLIC KEY-----
  5378. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5379. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5380. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5381. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5382. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5383. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5384. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5385. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5386. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5387. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5388. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5389. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5390. -----END PUBLIC KEY-----
  5391. DEVPUBKEY
  5392. );
  5393. file_put_contents(
  5394. $home.'/keys.tags.pub',
  5395. <<<TAGSPUBKEY
  5396. -----BEGIN PUBLIC KEY-----
  5397. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5398. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5399. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5400. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5401. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5402. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5403. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5404. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5405. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5406. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5407. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5408. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5409. -----END PUBLIC KEY-----
  5410. TAGSPUBKEY
  5411. );
  5412. }
  5413. $pubkeyid = openssl_pkey_get_public($sigFile);
  5414. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5415. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5416. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5417. }
  5418. $signature = json_decode($signature, true);
  5419. $signature = base64_decode($signature['sha384']);
  5420. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5421. if (PHP_VERSION_ID < 80000) {
  5422. openssl_free_key($pubkeyid);
  5423. }
  5424. if (!$verified) {
  5425. 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');
  5426. }
  5427. }
  5428. if ($input->getOption('clean-backups')) {
  5429. $this->cleanBackups($rollbackDir);
  5430. }
  5431. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5432. @unlink($tempFilename);
  5433. return 1;
  5434. }
  5435. if (file_exists($backupFile)) {
  5436. $io->writeError(sprintf(
  5437. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5438. Composer::VERSION
  5439. ));
  5440. } else {
  5441. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5442. }
  5443. return 0;
  5444. }
  5445. protected function fetchKeys(IOInterface $io, Config $config)
  5446. {
  5447. if (!$io->isInteractive()) {
  5448. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5449. }
  5450. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5451. $validator = function ($value) {
  5452. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5453. throw new \UnexpectedValueException('Invalid input');
  5454. }
  5455. return trim($value)."\n";
  5456. };
  5457. $devKey = '';
  5458. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5459. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5460. while ($line = $io->ask('')) {
  5461. $devKey .= trim($line)."\n";
  5462. if (trim($line) === '-----END PUBLIC KEY-----') {
  5463. break;
  5464. }
  5465. }
  5466. }
  5467. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5468. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5469. $tagsKey = '';
  5470. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5471. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5472. while ($line = $io->ask('')) {
  5473. $tagsKey .= trim($line)."\n";
  5474. if (trim($line) === '-----END PUBLIC KEY-----') {
  5475. break;
  5476. }
  5477. }
  5478. }
  5479. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5480. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5481. $io->write('Public keys stored in '.$config->get('home'));
  5482. }
  5483. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5484. {
  5485. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5486. if (!$rollbackVersion) {
  5487. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5488. }
  5489. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5490. if (!is_file($oldFile)) {
  5491. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5492. }
  5493. if (!is_readable($oldFile)) {
  5494. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5495. }
  5496. $io = $this->getIO();
  5497. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5498. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  5499. return 1;
  5500. }
  5501. return 0;
  5502. }
  5503. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5504. {
  5505. $io = $this->getIO();
  5506. @chmod($newFilename, fileperms($localFilename));
  5507. if (!$this->validatePhar($newFilename, $error)) {
  5508. $io->writeError('<error>The '.($backupTarget ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  5509. if ($backupTarget) {
  5510. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5511. }
  5512. return false;
  5513. }
  5514. if ($backupTarget) {
  5515. @copy($localFilename, $backupTarget);
  5516. }
  5517. try {
  5518. rename($newFilename, $localFilename);
  5519. return true;
  5520. } catch (\Exception $e) {
  5521. if (!is_writable(dirname($localFilename))
  5522. && $io->isInteractive()
  5523. && $this->isWindowsNonAdminUser()) {
  5524. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  5525. }
  5526. $action = 'Composer '.($backupTarget ? 'update' : 'rollback');
  5527. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  5528. }
  5529. }
  5530. protected function cleanBackups($rollbackDir, $except = null)
  5531. {
  5532. $finder = $this->getOldInstallationFinder($rollbackDir);
  5533. $io = $this->getIO();
  5534. $fs = new Filesystem;
  5535. foreach ($finder as $file) {
  5536. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5537. continue;
  5538. }
  5539. $file = (string) $file;
  5540. $io->writeError('<info>Removing: '.$file.'</info>');
  5541. $fs->remove($file);
  5542. }
  5543. }
  5544. protected function getLastBackupVersion($rollbackDir)
  5545. {
  5546. $finder = $this->getOldInstallationFinder($rollbackDir);
  5547. $finder->sortByName();
  5548. $files = iterator_to_array($finder);
  5549. if (count($files)) {
  5550. return basename(end($files), self::OLD_INSTALL_EXT);
  5551. }
  5552. return false;
  5553. }
  5554. protected function getOldInstallationFinder($rollbackDir)
  5555. {
  5556. $finder = Finder::create()
  5557. ->depth(0)
  5558. ->files()
  5559. ->name('*' . self::OLD_INSTALL_EXT)
  5560. ->in($rollbackDir);
  5561. return $finder;
  5562. }
  5563. protected function validatePhar($pharFile, &$error)
  5564. {
  5565. if (ini_get('phar.readonly')) {
  5566. return true;
  5567. }
  5568. try {
  5569. $phar = new \Phar($pharFile);
  5570. unset($phar);
  5571. $result = true;
  5572. } catch (\Exception $e) {
  5573. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5574. throw $e;
  5575. }
  5576. $error = $e->getMessage();
  5577. $result = false;
  5578. }
  5579. return $result;
  5580. }
  5581. protected function isWindowsNonAdminUser()
  5582. {
  5583. if (!Platform::isWindows()) {
  5584. return false;
  5585. }
  5586. exec('fltmc.exe filters', $output, $exitCode);
  5587. return $exitCode !== 0;
  5588. }
  5589. protected function tryAsWindowsAdmin($localFilename, $newFilename)
  5590. {
  5591. $io = $this->getIO();
  5592. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  5593. $helpMessage = 'Please run the self-update command as an Administrator.';
  5594. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  5595. if (!$io->askConfirmation($question, false)) {
  5596. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  5597. return false;
  5598. }
  5599. $tmpFile = tempnam(sys_get_temp_dir(), '');
  5600. $script = $tmpFile.'.vbs';
  5601. rename($tmpFile, $script);
  5602. $checksum = hash_file('sha256', $newFilename);
  5603. $source = str_replace('/', '\\', $newFilename);
  5604. $destination = str_replace('/', '\\', $localFilename);
  5605. $vbs = <<<EOT
  5606. Set UAC = CreateObject("Shell.Application")
  5607. UAC.ShellExecute "cmd.exe", "/c move /y ""$source"" ""$destination""", "", "runas", 0
  5608. Wscript.Sleep(300)
  5609. EOT;
  5610. file_put_contents($script, $vbs);
  5611. exec('"'.$script.'"');
  5612. @unlink($script);
  5613. if ($result = (hash_file('sha256', $localFilename) === $checksum)) {
  5614. $io->writeError('<info>Operation succeeded.</info>');
  5615. } else {
  5616. $io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
  5617. };
  5618. return $result;
  5619. }
  5620. }
  5621. <?php
  5622. namespace Composer\Command;
  5623. use Composer\Composer;
  5624. use Composer\DependencyResolver\DefaultPolicy;
  5625. use Composer\DependencyResolver\Pool;
  5626. use Composer\Json\JsonFile;
  5627. use Composer\Package\BasePackage;
  5628. use Composer\Package\CompletePackageInterface;
  5629. use Composer\Package\PackageInterface;
  5630. use Composer\Package\Version\VersionParser;
  5631. use Composer\Package\Version\VersionSelector;
  5632. use Composer\Plugin\CommandEvent;
  5633. use Composer\Plugin\PluginEvents;
  5634. use Composer\Repository\ArrayRepository;
  5635. use Composer\Repository\ComposerRepository;
  5636. use Composer\Repository\CompositeRepository;
  5637. use Composer\Repository\PlatformRepository;
  5638. use Composer\Repository\RepositoryFactory;
  5639. use Composer\Repository\RepositoryInterface;
  5640. use Composer\Semver\Constraint\ConstraintInterface;
  5641. use Composer\Semver\Semver;
  5642. use Composer\Spdx\SpdxLicenses;
  5643. use Composer\Util\Platform;
  5644. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5645. use Symfony\Component\Console\Input\InputArgument;
  5646. use Symfony\Component\Console\Input\InputInterface;
  5647. use Symfony\Component\Console\Input\InputOption;
  5648. use Symfony\Component\Console\Output\OutputInterface;
  5649. use Symfony\Component\Console\Terminal;
  5650. class ShowCommand extends BaseCommand
  5651. {
  5652. protected $versionParser;
  5653. protected $colors;
  5654. private $pool;
  5655. protected function configure()
  5656. {
  5657. $this
  5658. ->setName('show')
  5659. ->setAliases(array('info'))
  5660. ->setDescription('Shows information about packages.')
  5661. ->setDefinition(array(
  5662. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5663. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5664. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5665. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5666. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5667. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5668. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5669. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5670. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5671. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5672. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5673. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5674. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5675. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5676. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5677. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5678. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5679. ))
  5680. ->setHelp(
  5681. <<<EOT
  5682. The show command displays detailed information about a package, or
  5683. lists all packages available.
  5684. Read more at https://getcomposer.org/doc/03-cli.md#show
  5685. EOT
  5686. )
  5687. ;
  5688. }
  5689. protected function execute(InputInterface $input, OutputInterface $output)
  5690. {
  5691. $this->versionParser = new VersionParser;
  5692. if ($input->getOption('tree')) {
  5693. $this->initStyles($output);
  5694. }
  5695. $composer = $this->getComposer(false);
  5696. $io = $this->getIO();
  5697. if ($input->getOption('installed')) {
  5698. $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>');
  5699. }
  5700. if ($input->getOption('outdated')) {
  5701. $input->setOption('latest', true);
  5702. } elseif ($input->getOption('ignore')) {
  5703. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5704. }
  5705. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5706. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5707. return 1;
  5708. }
  5709. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5710. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5711. return 1;
  5712. }
  5713. if ($input->getOption('tree') && $input->getOption('latest')) {
  5714. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5715. return 1;
  5716. }
  5717. if ($input->getOption('tree') && $input->getOption('path')) {
  5718. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  5719. return 1;
  5720. }
  5721. $format = $input->getOption('format');
  5722. if (!in_array($format, array('text', 'json'))) {
  5723. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5724. return 1;
  5725. }
  5726. $platformOverrides = array();
  5727. if ($composer) {
  5728. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5729. }
  5730. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5731. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5732. if ($input->getOption('self')) {
  5733. $package = $this->getComposer()->getPackage();
  5734. if ($input->getOption('name-only')) {
  5735. $io->write($package->getName());
  5736. return 0;
  5737. }
  5738. $repos = $installedRepo = new ArrayRepository(array($package));
  5739. } elseif ($input->getOption('platform')) {
  5740. $repos = $installedRepo = $platformRepo;
  5741. } elseif ($input->getOption('available')) {
  5742. $installedRepo = $platformRepo;
  5743. if ($composer) {
  5744. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5745. } else {
  5746. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5747. $repos = new CompositeRepository($defaultRepos);
  5748. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5749. }
  5750. } elseif ($input->getOption('all') && $composer) {
  5751. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5752. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5753. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5754. } elseif ($input->getOption('all')) {
  5755. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5756. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5757. $installedRepo = $platformRepo;
  5758. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5759. } else {
  5760. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5761. $rootPkg = $this->getComposer()->getPackage();
  5762. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5763. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5764. }
  5765. }
  5766. if ($composer) {
  5767. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5768. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5769. }
  5770. if ($input->getOption('latest') && null === $composer) {
  5771. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5772. $input->setOption('latest', false);
  5773. }
  5774. $packageFilter = $input->getArgument('package');
  5775. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5776. if (empty($package)) {
  5777. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5778. if (empty($package)) {
  5779. $options = $input->getOptions();
  5780. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5781. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $input->getArgument('package')) && !$input->getOption('platform')) {
  5782. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found, try using --platform (-p) to show platform packages.');
  5783. }
  5784. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5785. }
  5786. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5787. return 1;
  5788. }
  5789. } else {
  5790. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5791. }
  5792. $exitCode = 0;
  5793. if ($input->getOption('tree')) {
  5794. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5795. if ('json' === $format) {
  5796. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5797. } else {
  5798. $this->displayPackageTree(array($arrayTree));
  5799. }
  5800. } else {
  5801. $latestPackage = null;
  5802. if ($input->getOption('latest')) {
  5803. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5804. }
  5805. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5806. $exitCode = 1;
  5807. }
  5808. if ($input->getOption('path')) {
  5809. $io->write($package->getName(), false);
  5810. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5811. return $exitCode;
  5812. }
  5813. if ('json' === $format) {
  5814. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  5815. } else {
  5816. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  5817. }
  5818. }
  5819. return $exitCode;
  5820. }
  5821. if ($input->getOption('tree')) {
  5822. $rootRequires = $this->getRootRequires();
  5823. $packages = $installedRepo->getPackages();
  5824. usort($packages, 'strcmp');
  5825. $arrayTree = array();
  5826. foreach ($packages as $package) {
  5827. if (in_array($package->getName(), $rootRequires, true)) {
  5828. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5829. }
  5830. }
  5831. if ('json' === $format) {
  5832. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5833. } else {
  5834. $this->displayPackageTree($arrayTree);
  5835. }
  5836. return 0;
  5837. }
  5838. if ($repos instanceof CompositeRepository) {
  5839. $repos = $repos->getRepositories();
  5840. } elseif (!is_array($repos)) {
  5841. $repos = array($repos);
  5842. }
  5843. $packages = array();
  5844. if (null !== $packageFilter) {
  5845. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5846. }
  5847. $packageListFilter = array();
  5848. if ($input->getOption('direct')) {
  5849. $packageListFilter = $this->getRootRequires();
  5850. }
  5851. if (class_exists('Symfony\Component\Console\Terminal')) {
  5852. $terminal = new Terminal();
  5853. $width = $terminal->getWidth();
  5854. } else {
  5855. list($width) = $this->getApplication()->getTerminalDimensions();
  5856. }
  5857. if (null === $width) {
  5858. $width = PHP_INT_MAX;
  5859. }
  5860. if (Platform::isWindows()) {
  5861. $width--;
  5862. } else {
  5863. $width = max(80, $width);
  5864. }
  5865. if ($input->getOption('path') && null === $composer) {
  5866. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5867. $input->setOption('path', false);
  5868. }
  5869. foreach ($repos as $repo) {
  5870. if ($repo === $platformRepo) {
  5871. $type = 'platform';
  5872. } elseif (
  5873. $repo === $installedRepo
  5874. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5875. ) {
  5876. $type = 'installed';
  5877. } else {
  5878. $type = 'available';
  5879. }
  5880. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5881. foreach ($repo->getProviderNames() as $name) {
  5882. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5883. $packages[$type][$name] = $name;
  5884. }
  5885. }
  5886. } else {
  5887. foreach ($repo->getPackages() as $package) {
  5888. if (!isset($packages[$type][$package->getName()])
  5889. || !is_object($packages[$type][$package->getName()])
  5890. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5891. ) {
  5892. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5893. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5894. $packages[$type][$package->getName()] = $package;
  5895. }
  5896. }
  5897. }
  5898. }
  5899. }
  5900. }
  5901. $showAllTypes = $input->getOption('all');
  5902. $showLatest = $input->getOption('latest');
  5903. $showMinorOnly = $input->getOption('minor-only');
  5904. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5905. $indent = $showAllTypes ? ' ' : '';
  5906. $latestPackages = array();
  5907. $exitCode = 0;
  5908. $viewData = array();
  5909. $viewMetaData = array();
  5910. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5911. if (isset($packages[$type])) {
  5912. ksort($packages[$type]);
  5913. $nameLength = $versionLength = $latestLength = 0;
  5914. if ($showLatest && $showVersion) {
  5915. foreach ($packages[$type] as $package) {
  5916. if (is_object($package)) {
  5917. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5918. if ($latestPackage === false) {
  5919. continue;
  5920. }
  5921. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5922. }
  5923. }
  5924. }
  5925. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5926. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5927. $writeLatest = $writeVersion && $showLatest;
  5928. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5929. $hasOutdatedPackages = false;
  5930. $viewData[$type] = array();
  5931. foreach ($packages[$type] as $package) {
  5932. $packageViewData = array();
  5933. if (is_object($package)) {
  5934. $latestPackage = null;
  5935. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5936. $latestPackage = $latestPackages[$package->getPrettyName()];
  5937. }
  5938. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5939. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5940. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5941. continue;
  5942. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5943. $hasOutdatedPackages = true;
  5944. }
  5945. $packageViewData['name'] = $package->getPrettyName();
  5946. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5947. if ($writeVersion) {
  5948. $packageViewData['version'] = $package->getFullPrettyVersion();
  5949. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5950. }
  5951. if ($writeLatest && $latestPackage) {
  5952. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5953. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5954. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5955. }
  5956. if ($writeDescription) {
  5957. $packageViewData['description'] = $package->getDescription();
  5958. }
  5959. if ($writePath) {
  5960. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5961. }
  5962. if ($latestPackage && $latestPackage->isAbandoned()) {
  5963. $replacement = is_string($latestPackage->getReplacementPackage())
  5964. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5965. : 'No replacement was suggested';
  5966. $packageWarning = sprintf(
  5967. 'Package %s is abandoned, you should avoid using it. %s.',
  5968. $package->getPrettyName(),
  5969. $replacement
  5970. );
  5971. $packageViewData['warning'] = $packageWarning;
  5972. }
  5973. } else {
  5974. $packageViewData['name'] = $package;
  5975. $nameLength = max($nameLength, strlen($package));
  5976. }
  5977. $viewData[$type][] = $packageViewData;
  5978. }
  5979. $viewMetaData[$type] = array(
  5980. 'nameLength' => $nameLength,
  5981. 'versionLength' => $versionLength,
  5982. 'latestLength' => $latestLength,
  5983. );
  5984. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5985. $exitCode = 1;
  5986. break;
  5987. }
  5988. }
  5989. }
  5990. if ('json' === $format) {
  5991. $io->write(JsonFile::encode($viewData));
  5992. } else {
  5993. foreach ($viewData as $type => $packages) {
  5994. $nameLength = $viewMetaData[$type]['nameLength'];
  5995. $versionLength = $viewMetaData[$type]['versionLength'];
  5996. $latestLength = $viewMetaData[$type]['latestLength'];
  5997. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5998. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5999. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  6000. if ($writeLatest && !$io->isDecorated()) {
  6001. $latestLength += 2;
  6002. }
  6003. if ($showAllTypes) {
  6004. if ('available' === $type) {
  6005. $io->write('<comment>' . $type . '</comment>:');
  6006. } else {
  6007. $io->write('<info>' . $type . '</info>:');
  6008. }
  6009. }
  6010. foreach ($packages as $package) {
  6011. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  6012. if (isset($package['version']) && $writeVersion) {
  6013. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  6014. }
  6015. if (isset($package['latest']) && $writeLatest) {
  6016. $latestVersion = $package['latest'];
  6017. $updateStatus = $package['latest-status'];
  6018. $style = $this->updateStatusToVersionStyle($updateStatus);
  6019. if (!$io->isDecorated()) {
  6020. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  6021. }
  6022. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  6023. }
  6024. if (isset($package['description']) && $writeDescription) {
  6025. $description = strtok($package['description'], "\r\n");
  6026. $remaining = $width - $nameLength - $versionLength - 4;
  6027. if ($writeLatest) {
  6028. $remaining -= $latestLength;
  6029. }
  6030. if (strlen($description) > $remaining) {
  6031. $description = substr($description, 0, $remaining - 3) . '...';
  6032. }
  6033. $io->write(' ' . $description, false);
  6034. }
  6035. if (isset($package['path'])) {
  6036. $io->write(' ' . $package['path'], false);
  6037. }
  6038. $io->write('');
  6039. if (isset($package['warning'])) {
  6040. $io->write('<warning>' . $package['warning'] . '</warning>');
  6041. }
  6042. }
  6043. if ($showAllTypes) {
  6044. $io->write('');
  6045. }
  6046. }
  6047. }
  6048. return $exitCode;
  6049. }
  6050. protected function getRootRequires()
  6051. {
  6052. $rootPackage = $this->getComposer()->getPackage();
  6053. return array_map(
  6054. 'strtolower',
  6055. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  6056. );
  6057. }
  6058. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  6059. {
  6060. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  6061. }
  6062. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  6063. {
  6064. $name = strtolower($name);
  6065. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  6066. $policy = new DefaultPolicy();
  6067. $pool = new Pool('dev');
  6068. $pool->addRepository($repos);
  6069. $matchedPackage = null;
  6070. $versions = array();
  6071. $matches = $pool->whatProvides($name, $constraint);
  6072. foreach ($matches as $index => $package) {
  6073. if ($package->getName() !== $name) {
  6074. unset($matches[$index]);
  6075. continue;
  6076. }
  6077. if (null === $version && $installedRepo->hasPackage($package)) {
  6078. $matchedPackage = $package;
  6079. }
  6080. $versions[$package->getPrettyVersion()] = $package->getVersion();
  6081. $matches[$index] = $package->getId();
  6082. }
  6083. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  6084. $matchedPackage = $pool->literalToPackage($preferred[0]);
  6085. }
  6086. return array($matchedPackage, $versions);
  6087. }
  6088. protected function printPackageInfo(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6089. {
  6090. $io = $this->getIO();
  6091. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  6092. $this->printLinks($package, 'requires');
  6093. $this->printLinks($package, 'devRequires', 'requires (dev)');
  6094. if ($package->getSuggests()) {
  6095. $io->write("\n<info>suggests</info>");
  6096. foreach ($package->getSuggests() as $suggested => $reason) {
  6097. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  6098. }
  6099. }
  6100. $this->printLinks($package, 'provides');
  6101. $this->printLinks($package, 'conflicts');
  6102. $this->printLinks($package, 'replaces');
  6103. }
  6104. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6105. {
  6106. $io = $this->getIO();
  6107. $io->write('<info>name</info> : ' . $package->getPrettyName());
  6108. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  6109. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  6110. $this->printVersions($package, $versions, $installedRepo);
  6111. if ($latestPackage) {
  6112. $style = $this->getVersionStyle($latestPackage, $package);
  6113. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  6114. } else {
  6115. $latestPackage = $package;
  6116. }
  6117. $io->write('<info>type</info> : ' . $package->getType());
  6118. $this->printLicenses($package);
  6119. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  6120. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  6121. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  6122. if ($installedRepo->hasPackage($package)) {
  6123. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  6124. }
  6125. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  6126. if ($latestPackage->isAbandoned()) {
  6127. $replacement = ($latestPackage->getReplacementPackage() !== null)
  6128. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  6129. : null;
  6130. $io->writeError(
  6131. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  6132. );
  6133. }
  6134. if ($package->getSupport()) {
  6135. $io->write("\n<info>support</info>");
  6136. foreach ($package->getSupport() as $type => $value) {
  6137. $io->write('<comment>' . $type . '</comment> : '.$value);
  6138. }
  6139. }
  6140. if ($package->getAutoload()) {
  6141. $io->write("\n<info>autoload</info>");
  6142. foreach ($package->getAutoload() as $type => $autoloads) {
  6143. $io->write('<comment>' . $type . '</comment>');
  6144. if ($type === 'psr-0') {
  6145. foreach ($autoloads as $name => $path) {
  6146. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6147. }
  6148. } elseif ($type === 'psr-4') {
  6149. foreach ($autoloads as $name => $path) {
  6150. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6151. }
  6152. } elseif ($type === 'classmap') {
  6153. $io->write(implode(', ', $autoloads));
  6154. }
  6155. }
  6156. if ($package->getIncludePaths()) {
  6157. $io->write('<comment>include-path</comment>');
  6158. $io->write(implode(', ', $package->getIncludePaths()));
  6159. }
  6160. }
  6161. }
  6162. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  6163. {
  6164. uasort($versions, 'version_compare');
  6165. $versions = array_keys(array_reverse($versions));
  6166. if ($installedRepo->hasPackage($package)) {
  6167. $installedVersion = $package->getPrettyVersion();
  6168. $key = array_search($installedVersion, $versions);
  6169. if (false !== $key) {
  6170. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  6171. }
  6172. }
  6173. $versions = implode(', ', $versions);
  6174. $this->getIO()->write('<info>versions</info> : ' . $versions);
  6175. }
  6176. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  6177. {
  6178. $title = $title ?: $linkType;
  6179. $io = $this->getIO();
  6180. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  6181. $io->write("\n<info>" . $title . "</info>");
  6182. foreach ($links as $link) {
  6183. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  6184. }
  6185. }
  6186. }
  6187. protected function printLicenses(CompletePackageInterface $package)
  6188. {
  6189. $spdxLicenses = new SpdxLicenses();
  6190. $licenses = $package->getLicense();
  6191. $io = $this->getIO();
  6192. foreach ($licenses as $licenseId) {
  6193. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6194. if (!$license) {
  6195. $out = $licenseId;
  6196. } else {
  6197. if ($license[1] === true) {
  6198. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  6199. } else {
  6200. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  6201. }
  6202. }
  6203. $io->write('<info>license</info> : ' . $out);
  6204. }
  6205. }
  6206. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6207. {
  6208. $json = array(
  6209. 'name' => $package->getPrettyName(),
  6210. 'description' => $package->getDescription(),
  6211. 'keywords' => $package->getKeywords() ?: array(),
  6212. 'type' => $package->getType(),
  6213. 'homepage' => $package->getHomepage(),
  6214. 'names' => $package->getNames()
  6215. );
  6216. $json = $this->appendVersions($json, $versions);
  6217. $json = $this->appendLicenses($json, $package);
  6218. if ($latestPackage) {
  6219. $json['latest'] = $latestPackage->getPrettyVersion();
  6220. } else {
  6221. $latestPackage = $package;
  6222. }
  6223. if ($package->getSourceType()) {
  6224. $json['source'] = array(
  6225. 'type' => $package->getSourceType(),
  6226. 'url' => $package->getSourceUrl(),
  6227. 'reference' => $package->getSourceReference()
  6228. );
  6229. }
  6230. if ($package->getDistType()) {
  6231. $json['dist'] = array(
  6232. 'type' => $package->getDistType(),
  6233. 'url' => $package->getDistUrl(),
  6234. 'reference' => $package->getDistReference()
  6235. );
  6236. }
  6237. if ($installedRepo->hasPackage($package)) {
  6238. $json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package));
  6239. if ($json['path'] === false) {
  6240. unset($json['path']);
  6241. }
  6242. }
  6243. if ($latestPackage->isAbandoned()) {
  6244. $json['replacement'] = $latestPackage->getReplacementPackage();
  6245. }
  6246. if ($package->getSuggests()) {
  6247. $json['suggests'] = $package->getSuggests();
  6248. }
  6249. if ($package->getSupport()) {
  6250. $json['support'] = $package->getSupport();
  6251. }
  6252. $json = $this->appendAutoload($json, $package);
  6253. if ($package->getIncludePaths()) {
  6254. $json['include_path'] = $package->getIncludePaths();
  6255. }
  6256. $json = $this->appendLinks($json, $package);
  6257. $this->getIO()->write(JsonFile::encode($json));
  6258. }
  6259. private function appendVersions($json, array $versions)
  6260. {
  6261. uasort($versions, 'version_compare');
  6262. $versions = array_keys(array_reverse($versions));
  6263. $json['versions'] = $versions;
  6264. return $json;
  6265. }
  6266. private function appendLicenses($json, CompletePackageInterface $package)
  6267. {
  6268. if ($licenses = $package->getLicense()) {
  6269. $spdxLicenses = new SpdxLicenses();
  6270. $json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
  6271. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6272. if (!$license) {
  6273. return $licenseId;
  6274. }
  6275. return array(
  6276. 'name' => $license[0],
  6277. 'osi' => $licenseId,
  6278. 'url' => $license[2]
  6279. );
  6280. }, $licenses);
  6281. }
  6282. return $json;
  6283. }
  6284. private function appendAutoload($json, CompletePackageInterface $package)
  6285. {
  6286. if ($package->getAutoload()) {
  6287. $autoload = array();
  6288. foreach ($package->getAutoload() as $type => $autoloads) {
  6289. if ($type === 'psr-0' || $type === 'psr-4') {
  6290. $psr = array();
  6291. foreach ($autoloads as $name => $path) {
  6292. if (!$path) {
  6293. $path = '.';
  6294. }
  6295. $psr[$name ?: '*'] = $path;
  6296. }
  6297. $autoload[$type] = $psr;
  6298. } elseif ($type === 'classmap') {
  6299. $autoload['classmap'] = $autoloads;
  6300. }
  6301. }
  6302. $json['autoload'] = $autoload;
  6303. }
  6304. return $json;
  6305. }
  6306. private function appendLinks($json, CompletePackageInterface $package)
  6307. {
  6308. foreach (array('requires', 'devRequires', 'provides', 'conflicts', 'replaces') as $linkType) {
  6309. $json = $this->appendLink($json, $package, $linkType);
  6310. }
  6311. return $json;
  6312. }
  6313. private function appendLink($json, CompletePackageInterface $package, $linkType)
  6314. {
  6315. $links = $package->{'get' . ucfirst($linkType)}();
  6316. if ($links) {
  6317. $json[$linkType] = array();
  6318. foreach ($links as $link) {
  6319. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  6320. }
  6321. }
  6322. return $json;
  6323. }
  6324. protected function initStyles(OutputInterface $output)
  6325. {
  6326. $this->colors = array(
  6327. 'green',
  6328. 'yellow',
  6329. 'cyan',
  6330. 'magenta',
  6331. 'blue',
  6332. );
  6333. foreach ($this->colors as $color) {
  6334. $style = new OutputFormatterStyle($color);
  6335. $output->getFormatter()->setStyle($color, $style);
  6336. }
  6337. }
  6338. protected function displayPackageTree(array $arrayTree)
  6339. {
  6340. $io = $this->getIO();
  6341. foreach ($arrayTree as $package) {
  6342. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  6343. $io->write(' ' . $package['version'], false);
  6344. $io->write(' ' . strtok($package['description'], "\r\n"));
  6345. if (isset($package['requires'])) {
  6346. $requires = $package['requires'];
  6347. $treeBar = '├';
  6348. $j = 0;
  6349. $total = count($requires);
  6350. foreach ($requires as $require) {
  6351. $requireName = $require['name'];
  6352. $j++;
  6353. if ($j === $total) {
  6354. $treeBar = 'â””';
  6355. }
  6356. $level = 1;
  6357. $color = $this->colors[$level];
  6358. $info = sprintf(
  6359. '%s──<%s>%s</%s> %s',
  6360. $treeBar,
  6361. $color,
  6362. $requireName,
  6363. $color,
  6364. $require['version']
  6365. );
  6366. $this->writeTreeLine($info);
  6367. $treeBar = str_replace('â””', ' ', $treeBar);
  6368. $packagesInTree = array($package['name'], $requireName);
  6369. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  6370. }
  6371. }
  6372. }
  6373. }
  6374. protected function generatePackageTree(
  6375. PackageInterface $package,
  6376. RepositoryInterface $installedRepo,
  6377. RepositoryInterface $distantRepos
  6378. ) {
  6379. $requires = $package->getRequires();
  6380. ksort($requires);
  6381. $children = array();
  6382. foreach ($requires as $requireName => $require) {
  6383. $packagesInTree = array($package->getName(), $requireName);
  6384. $treeChildDesc = array(
  6385. 'name' => $requireName,
  6386. 'version' => $require->getPrettyConstraint(),
  6387. );
  6388. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  6389. if ($deepChildren) {
  6390. $treeChildDesc['requires'] = $deepChildren;
  6391. }
  6392. $children[] = $treeChildDesc;
  6393. }
  6394. $tree = array(
  6395. 'name' => $package->getPrettyName(),
  6396. 'version' => $package->getPrettyVersion(),
  6397. 'description' => $package->getDescription(),
  6398. );
  6399. if ($children) {
  6400. $tree['requires'] = $children;
  6401. }
  6402. return $tree;
  6403. }
  6404. protected function displayTree(
  6405. $package,
  6406. array $packagesInTree,
  6407. $previousTreeBar = '├',
  6408. $level = 1
  6409. ) {
  6410. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  6411. if (isset($package['requires'])) {
  6412. $requires = $package['requires'];
  6413. $treeBar = $previousTreeBar . ' ├';
  6414. $i = 0;
  6415. $total = count($requires);
  6416. foreach ($requires as $require) {
  6417. $currentTree = $packagesInTree;
  6418. $i++;
  6419. if ($i === $total) {
  6420. $treeBar = $previousTreeBar . ' â””';
  6421. }
  6422. $colorIdent = $level % count($this->colors);
  6423. $color = $this->colors[$colorIdent];
  6424. $circularWarn = in_array(
  6425. $require['name'],
  6426. $currentTree,
  6427. true
  6428. ) ? '(circular dependency aborted here)' : '';
  6429. $info = rtrim(sprintf(
  6430. '%s──<%s>%s</%s> %s %s',
  6431. $treeBar,
  6432. $color,
  6433. $require['name'],
  6434. $color,
  6435. $require['version'],
  6436. $circularWarn
  6437. ));
  6438. $this->writeTreeLine($info);
  6439. $treeBar = str_replace('â””', ' ', $treeBar);
  6440. $currentTree[] = $require['name'];
  6441. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  6442. }
  6443. }
  6444. }
  6445. protected function addTree(
  6446. $name,
  6447. $package,
  6448. RepositoryInterface $installedRepo,
  6449. RepositoryInterface $distantRepos,
  6450. array $packagesInTree
  6451. ) {
  6452. $children = array();
  6453. list($package, $versions) = $this->getPackage(
  6454. $installedRepo,
  6455. $distantRepos,
  6456. $name,
  6457. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  6458. );
  6459. if (is_object($package)) {
  6460. $requires = $package->getRequires();
  6461. ksort($requires);
  6462. foreach ($requires as $requireName => $require) {
  6463. $currentTree = $packagesInTree;
  6464. $treeChildDesc = array(
  6465. 'name' => $requireName,
  6466. 'version' => $require->getPrettyConstraint(),
  6467. );
  6468. if (!in_array($requireName, $currentTree, true)) {
  6469. $currentTree[] = $requireName;
  6470. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  6471. if ($deepChildren) {
  6472. $treeChildDesc['requires'] = $deepChildren;
  6473. }
  6474. }
  6475. $children[] = $treeChildDesc;
  6476. }
  6477. }
  6478. return $children;
  6479. }
  6480. private function updateStatusToVersionStyle($updateStatus)
  6481. {
  6482. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  6483. }
  6484. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  6485. {
  6486. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  6487. return 'up-to-date';
  6488. }
  6489. $constraint = $package->getVersion();
  6490. if (0 !== strpos($constraint, 'dev-')) {
  6491. $constraint = '^'.$constraint;
  6492. }
  6493. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  6494. return 'semver-safe-update';
  6495. }
  6496. return 'update-possible';
  6497. }
  6498. private function writeTreeLine($line)
  6499. {
  6500. $io = $this->getIO();
  6501. if (!$io->isDecorated()) {
  6502. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  6503. }
  6504. $io->write($line);
  6505. }
  6506. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  6507. {
  6508. $name = $package->getName();
  6509. $versionSelector = new VersionSelector($this->getPool($composer));
  6510. $stability = $composer->getPackage()->getMinimumStability();
  6511. $flags = $composer->getPackage()->getStabilityFlags();
  6512. if (isset($flags[$name])) {
  6513. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  6514. }
  6515. $bestStability = $stability;
  6516. if ($composer->getPackage()->getPreferStable()) {
  6517. $bestStability = $package->getStability();
  6518. }
  6519. $targetVersion = null;
  6520. if (0 === strpos($package->getVersion(), 'dev-')) {
  6521. $targetVersion = $package->getVersion();
  6522. }
  6523. if ($targetVersion === null && $minorOnly) {
  6524. $targetVersion = '^' . $package->getVersion();
  6525. }
  6526. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  6527. }
  6528. private function getPool(Composer $composer)
  6529. {
  6530. if (!$this->pool) {
  6531. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  6532. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  6533. }
  6534. return $this->pool;
  6535. }
  6536. }
  6537. <?php
  6538. namespace Composer\Command;
  6539. use Symfony\Component\Console\Input\InputInterface;
  6540. use Symfony\Component\Console\Input\InputOption;
  6541. use Symfony\Component\Console\Output\OutputInterface;
  6542. use Composer\Downloader\ChangeReportInterface;
  6543. use Composer\Downloader\DvcsDownloaderInterface;
  6544. use Composer\Downloader\VcsCapableDownloaderInterface;
  6545. use Composer\Package\Dumper\ArrayDumper;
  6546. use Composer\Package\Version\VersionGuesser;
  6547. use Composer\Package\Version\VersionParser;
  6548. use Composer\Plugin\CommandEvent;
  6549. use Composer\Plugin\PluginEvents;
  6550. use Composer\Script\ScriptEvents;
  6551. use Composer\Util\ProcessExecutor;
  6552. class StatusCommand extends BaseCommand
  6553. {
  6554. const EXIT_CODE_ERRORS = 1;
  6555. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6556. const EXIT_CODE_VERSION_CHANGES = 4;
  6557. protected function configure()
  6558. {
  6559. $this
  6560. ->setName('status')
  6561. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  6562. ->setDefinition(array(
  6563. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6564. ))
  6565. ->setHelp(
  6566. <<<EOT
  6567. The status command displays a list of dependencies that have
  6568. been modified locally.
  6569. Read more at https://getcomposer.org/doc/03-cli.md#status
  6570. EOT
  6571. )
  6572. ;
  6573. }
  6574. protected function execute(InputInterface $input, OutputInterface $output)
  6575. {
  6576. $composer = $this->getComposer();
  6577. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6578. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6579. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6580. $exitCode = $this->doExecute($input, $output);
  6581. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6582. return $exitCode;
  6583. }
  6584. private function doExecute(InputInterface $input, OutputInterface $output)
  6585. {
  6586. $composer = $this->getComposer();
  6587. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6588. $dm = $composer->getDownloadManager();
  6589. $im = $composer->getInstallationManager();
  6590. $errors = array();
  6591. $io = $this->getIO();
  6592. $unpushedChanges = array();
  6593. $vcsVersionChanges = array();
  6594. $parser = new VersionParser;
  6595. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6596. $dumper = new ArrayDumper;
  6597. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6598. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6599. $targetDir = $im->getInstallPath($package);
  6600. if ($downloader instanceof ChangeReportInterface) {
  6601. if (is_link($targetDir)) {
  6602. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6603. }
  6604. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6605. $errors[$targetDir] = $changes;
  6606. }
  6607. }
  6608. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6609. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6610. switch ($package->getInstallationSource()) {
  6611. case 'source':
  6612. $previousRef = $package->getSourceReference();
  6613. break;
  6614. case 'dist':
  6615. $previousRef = $package->getDistReference();
  6616. break;
  6617. default:
  6618. $previousRef = null;
  6619. }
  6620. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6621. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6622. $vcsVersionChanges[$targetDir] = array(
  6623. 'previous' => array(
  6624. 'version' => $package->getPrettyVersion(),
  6625. 'ref' => $previousRef,
  6626. ),
  6627. 'current' => array(
  6628. 'version' => $currentVersion['pretty_version'],
  6629. 'ref' => $currentVersion['commit'],
  6630. ),
  6631. );
  6632. }
  6633. }
  6634. }
  6635. if ($downloader instanceof DvcsDownloaderInterface) {
  6636. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6637. $unpushedChanges[$targetDir] = $unpushed;
  6638. }
  6639. }
  6640. }
  6641. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6642. $io->writeError('<info>No local changes</info>');
  6643. return 0;
  6644. }
  6645. if ($errors) {
  6646. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6647. foreach ($errors as $path => $changes) {
  6648. if ($input->getOption('verbose')) {
  6649. $indentedChanges = implode("\n", array_map(function ($line) {
  6650. return ' ' . ltrim($line);
  6651. }, explode("\n", $changes)));
  6652. $io->write('<info>'.$path.'</info>:');
  6653. $io->write($indentedChanges);
  6654. } else {
  6655. $io->write($path);
  6656. }
  6657. }
  6658. }
  6659. if ($unpushedChanges) {
  6660. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6661. foreach ($unpushedChanges as $path => $changes) {
  6662. if ($input->getOption('verbose')) {
  6663. $indentedChanges = implode("\n", array_map(function ($line) {
  6664. return ' ' . ltrim($line);
  6665. }, explode("\n", $changes)));
  6666. $io->write('<info>'.$path.'</info>:');
  6667. $io->write($indentedChanges);
  6668. } else {
  6669. $io->write($path);
  6670. }
  6671. }
  6672. }
  6673. if ($vcsVersionChanges) {
  6674. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6675. foreach ($vcsVersionChanges as $path => $changes) {
  6676. if ($input->getOption('verbose')) {
  6677. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6678. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6679. if ($io->isVeryVerbose()) {
  6680. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6681. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6682. }
  6683. $io->write('<info>'.$path.'</info>:');
  6684. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6685. } else {
  6686. $io->write($path);
  6687. }
  6688. }
  6689. }
  6690. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6691. $io->writeError('Use --verbose (-v) to see a list of files');
  6692. }
  6693. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6694. }
  6695. }
  6696. <?php
  6697. namespace Composer\Command;
  6698. use Composer\Repository\PlatformRepository;
  6699. use Symfony\Component\Console\Input\InputArgument;
  6700. use Symfony\Component\Console\Input\InputInterface;
  6701. use Symfony\Component\Console\Input\InputOption;
  6702. use Symfony\Component\Console\Output\OutputInterface;
  6703. class SuggestsCommand extends BaseCommand
  6704. {
  6705. protected function configure()
  6706. {
  6707. $this
  6708. ->setName('suggests')
  6709. ->setDescription('Shows package suggestions.')
  6710. ->setDefinition(array(
  6711. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6712. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6713. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6714. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6715. ))
  6716. ->setHelp(
  6717. <<<EOT
  6718. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6719. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6720. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6721. EOT
  6722. )
  6723. ;
  6724. }
  6725. protected function execute(InputInterface $input, OutputInterface $output)
  6726. {
  6727. $lock = $this->getComposer()->getLocker()->getLockData();
  6728. if (empty($lock)) {
  6729. throw new \RuntimeException('Lockfile seems to be empty?');
  6730. }
  6731. $packages = $lock['packages'];
  6732. if (!$input->getOption('no-dev')) {
  6733. $packages += $lock['packages-dev'];
  6734. }
  6735. $filter = $input->getArgument('packages');
  6736. $installed = array();
  6737. foreach ($packages as $package) {
  6738. $installed[] = $package['name'];
  6739. if (!empty($package['provide'])) {
  6740. $installed = array_merge($installed, array_keys($package['provide']));
  6741. }
  6742. if (!empty($package['replace'])) {
  6743. $installed = array_merge($installed, array_keys($package['replace']));
  6744. }
  6745. }
  6746. $installed = array_flip($installed);
  6747. ksort($installed);
  6748. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6749. $suggesters = array();
  6750. $suggested = array();
  6751. foreach ($packages as $package) {
  6752. $packageName = $package['name'];
  6753. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6754. continue;
  6755. }
  6756. foreach ($package['suggest'] as $suggestion => $reason) {
  6757. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6758. continue;
  6759. }
  6760. if (!isset($installed[$suggestion])) {
  6761. $suggesters[$packageName][$suggestion] = $reason;
  6762. $suggested[$suggestion][$packageName] = $reason;
  6763. }
  6764. }
  6765. }
  6766. ksort($suggesters);
  6767. ksort($suggested);
  6768. $mode = 0;
  6769. $io = $this->getIO();
  6770. if ($input->getOption('by-package') || $io->isVerbose()) {
  6771. $mode |= 1;
  6772. }
  6773. if ($input->getOption('by-suggestion')) {
  6774. $mode |= 2;
  6775. }
  6776. if ($mode === 0) {
  6777. foreach (array_keys($suggested) as $suggestion) {
  6778. $io->write(sprintf('<info>%s</info>', $suggestion));
  6779. }
  6780. return 0;
  6781. }
  6782. if ($mode & 1) {
  6783. foreach ($suggesters as $suggester => $suggestions) {
  6784. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6785. foreach ($suggestions as $suggestion => $reason) {
  6786. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6787. }
  6788. $io->write('');
  6789. }
  6790. }
  6791. if ($mode & 2) {
  6792. if ($mode & 1) {
  6793. $io->write(str_repeat('-', 78));
  6794. }
  6795. foreach ($suggested as $suggestion => $suggesters) {
  6796. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6797. foreach ($suggesters as $suggester => $reason) {
  6798. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6799. }
  6800. $io->write('');
  6801. }
  6802. }
  6803. return 0;
  6804. }
  6805. }
  6806. <?php
  6807. namespace Composer\Command;
  6808. use Composer\Composer;
  6809. use Composer\Installer;
  6810. use Composer\IO\IOInterface;
  6811. use Composer\Plugin\CommandEvent;
  6812. use Composer\Plugin\PluginEvents;
  6813. use Symfony\Component\Console\Helper\Table;
  6814. use Symfony\Component\Console\Input\InputInterface;
  6815. use Symfony\Component\Console\Input\InputOption;
  6816. use Symfony\Component\Console\Input\InputArgument;
  6817. use Symfony\Component\Console\Output\OutputInterface;
  6818. use Symfony\Component\Console\Question\Question;
  6819. class UpdateCommand extends BaseCommand
  6820. {
  6821. protected function configure()
  6822. {
  6823. $this
  6824. ->setName('update')
  6825. ->setAliases(array('u', 'upgrade'))
  6826. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6827. ->setDefinition(array(
  6828. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6829. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6830. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6831. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6832. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6833. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6834. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6835. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6836. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6837. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6838. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6839. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6840. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of allowed packages to the allow list, except those defined in root package.'),
  6841. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of allowed packages to the allow list, including those defined in root package.'),
  6842. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6843. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6844. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6845. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6846. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6847. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6848. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6849. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6850. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6851. ))
  6852. ->setHelp(
  6853. <<<EOT
  6854. The <info>update</info> command reads the composer.json file from the
  6855. current directory, processes it, and updates, removes or installs all the
  6856. dependencies.
  6857. <info>php composer.phar update</info>
  6858. To limit the update operation to a few packages, you can list the package(s)
  6859. you want to update as such:
  6860. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6861. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6862. from a specific vendor:
  6863. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6864. To select packages names interactively with auto-completion use <info>-i</info>.
  6865. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6866. EOT
  6867. )
  6868. ;
  6869. }
  6870. protected function execute(InputInterface $input, OutputInterface $output)
  6871. {
  6872. $io = $this->getIO();
  6873. if ($input->getOption('no-custom-installers')) {
  6874. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6875. $input->setOption('no-plugins', true);
  6876. }
  6877. if ($input->getOption('dev')) {
  6878. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6879. }
  6880. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6881. $packages = $input->getArgument('packages');
  6882. if ($input->getOption('interactive')) {
  6883. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6884. }
  6885. if ($input->getOption('root-reqs')) {
  6886. $require = array_keys($composer->getPackage()->getRequires());
  6887. if (!$input->getOption('no-dev')) {
  6888. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6889. $require = array_merge($require, $requireDev);
  6890. }
  6891. if (!empty($packages)) {
  6892. $packages = array_intersect($packages, $require);
  6893. } else {
  6894. $packages = $require;
  6895. }
  6896. }
  6897. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6898. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6899. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6900. $install = Installer::create($io, $composer);
  6901. $config = $composer->getConfig();
  6902. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6903. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6904. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6905. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6906. $install
  6907. ->setDryRun($input->getOption('dry-run'))
  6908. ->setVerbose($input->getOption('verbose'))
  6909. ->setPreferSource($preferSource)
  6910. ->setPreferDist($preferDist)
  6911. ->setDevMode(!$input->getOption('no-dev'))
  6912. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6913. ->setRunScripts(!$input->getOption('no-scripts'))
  6914. ->setSkipSuggest($input->getOption('no-suggest'))
  6915. ->setOptimizeAutoloader($optimize)
  6916. ->setClassMapAuthoritative($authoritative)
  6917. ->setApcuAutoloader($apcu)
  6918. ->setUpdate(true)
  6919. ->setUpdateAllowList($input->getOption('lock') ? array('lock') : $packages)
  6920. ->setAllowListTransitiveDependencies($input->getOption('with-dependencies'))
  6921. ->setAllowListAllDependencies($input->getOption('with-all-dependencies'))
  6922. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6923. ->setPreferStable($input->getOption('prefer-stable'))
  6924. ->setPreferLowest($input->getOption('prefer-lowest'))
  6925. ;
  6926. if ($input->getOption('no-plugins')) {
  6927. $install->disablePlugins();
  6928. }
  6929. return $install->run();
  6930. }
  6931. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6932. {
  6933. if (!$input->isInteractive()) {
  6934. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6935. }
  6936. $requires = array_merge(
  6937. $composer->getPackage()->getRequires(),
  6938. $composer->getPackage()->getDevRequires()
  6939. );
  6940. $autocompleterValues = array();
  6941. foreach ($requires as $require) {
  6942. $target = $require->getTarget();
  6943. $autocompleterValues[strtolower($target)] = $target;
  6944. }
  6945. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6946. foreach ($installedPackages as $package) {
  6947. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6948. }
  6949. $helper = $this->getHelper('question');
  6950. $question = new Question('<comment>Enter package name: </comment>', null);
  6951. $io->writeError('<info>Press enter without value to end submission</info>');
  6952. do {
  6953. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6954. $question->setAutocompleterValues($autocompleterValues);
  6955. $addedPackage = $helper->ask($input, $output, $question);
  6956. if (!is_string($addedPackage) || empty($addedPackage)) {
  6957. break;
  6958. }
  6959. $addedPackage = strtolower($addedPackage);
  6960. if (!in_array($addedPackage, $packages)) {
  6961. $packages[] = $addedPackage;
  6962. }
  6963. } while (true);
  6964. $packages = array_filter($packages);
  6965. if (!$packages) {
  6966. throw new \InvalidArgumentException('You must enter minimum one package.');
  6967. }
  6968. $table = new Table($output);
  6969. $table->setHeaders(array('Selected packages'));
  6970. foreach ($packages as $package) {
  6971. $table->addRow(array($package));
  6972. }
  6973. $table->render();
  6974. if ($io->askConfirmation(sprintf(
  6975. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6976. 1 === count($packages) ? '' : 's'
  6977. ), true)) {
  6978. return $packages;
  6979. }
  6980. throw new \RuntimeException('Installation aborted.');
  6981. }
  6982. }
  6983. <?php
  6984. namespace Composer\Command;
  6985. use Composer\Factory;
  6986. use Composer\Package\Loader\ValidatingArrayLoader;
  6987. use Composer\Plugin\CommandEvent;
  6988. use Composer\Plugin\PluginEvents;
  6989. use Composer\Util\ConfigValidator;
  6990. use Symfony\Component\Console\Input\InputArgument;
  6991. use Symfony\Component\Console\Input\InputInterface;
  6992. use Symfony\Component\Console\Input\InputOption;
  6993. use Symfony\Component\Console\Output\OutputInterface;
  6994. class ValidateCommand extends BaseCommand
  6995. {
  6996. protected function configure()
  6997. {
  6998. $this
  6999. ->setName('validate')
  7000. ->setDescription('Validates a composer.json and composer.lock.')
  7001. ->setDefinition(array(
  7002. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  7003. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  7004. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  7005. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  7006. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  7007. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  7008. ))
  7009. ->setHelp(
  7010. <<<EOT
  7011. The validate command validates a given composer.json and composer.lock
  7012. Exit codes in case of errors are:
  7013. 1 validation warning(s), only when --strict is given
  7014. 2 validation error(s)
  7015. 3 file unreadable or missing
  7016. Read more at https://getcomposer.org/doc/03-cli.md#validate
  7017. EOT
  7018. );
  7019. }
  7020. protected function execute(InputInterface $input, OutputInterface $output)
  7021. {
  7022. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  7023. $io = $this->getIO();
  7024. if (!file_exists($file)) {
  7025. $io->writeError('<error>' . $file . ' not found.</error>');
  7026. return 3;
  7027. }
  7028. if (!is_readable($file)) {
  7029. $io->writeError('<error>' . $file . ' is not readable.</error>');
  7030. return 3;
  7031. }
  7032. $validator = new ConfigValidator($io);
  7033. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  7034. $checkPublish = !$input->getOption('no-check-publish');
  7035. $checkLock = !$input->getOption('no-check-lock');
  7036. $isStrict = $input->getOption('strict');
  7037. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7038. $lockErrors = array();
  7039. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  7040. $locker = $composer->getLocker();
  7041. if ($locker->isLocked() && !$locker->isFresh()) {
  7042. $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>`.';
  7043. }
  7044. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  7045. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7046. if ($input->getOption('with-dependencies')) {
  7047. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7048. foreach ($localRepo->getPackages() as $package) {
  7049. $path = $composer->getInstallationManager()->getInstallPath($package);
  7050. $file = $path . '/composer.json';
  7051. if (is_dir($path) && file_exists($file)) {
  7052. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7053. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  7054. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7055. $exitCode = max($depCode, $exitCode);
  7056. }
  7057. }
  7058. }
  7059. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  7060. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7061. $exitCode = max($eventCode, $exitCode);
  7062. return $exitCode;
  7063. }
  7064. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  7065. {
  7066. $doPrintSchemaUrl = false;
  7067. if ($errors) {
  7068. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  7069. } elseif ($publishErrors) {
  7070. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  7071. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  7072. $doPrintSchemaUrl = $printSchemaUrl;
  7073. } elseif ($warnings) {
  7074. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  7075. $doPrintSchemaUrl = $printSchemaUrl;
  7076. } else {
  7077. $io->write('<info>' . $name . ' is valid</info>');
  7078. }
  7079. if ($doPrintSchemaUrl) {
  7080. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  7081. }
  7082. $extraWarnings = array();
  7083. if ($checkPublish) {
  7084. $errors = array_merge($errors, $publishErrors);
  7085. } else {
  7086. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  7087. }
  7088. if ($checkLock) {
  7089. $errors = array_merge($errors, $lockErrors);
  7090. } else {
  7091. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  7092. }
  7093. $messages = array(
  7094. 'error' => $errors,
  7095. 'warning' => array_merge($warnings, $extraWarnings),
  7096. );
  7097. foreach ($messages as $style => $msgs) {
  7098. foreach ($msgs as $msg) {
  7099. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  7100. }
  7101. }
  7102. }
  7103. }
  7104. <?php
  7105. namespace Composer;
  7106. use Composer\Package\RootPackageInterface;
  7107. use Composer\Package\Locker;
  7108. use Composer\Repository\RepositoryManager;
  7109. use Composer\Installer\InstallationManager;
  7110. use Composer\Plugin\PluginManager;
  7111. use Composer\Downloader\DownloadManager;
  7112. use Composer\EventDispatcher\EventDispatcher;
  7113. use Composer\Autoload\AutoloadGenerator;
  7114. use Composer\Package\Archiver\ArchiveManager;
  7115. class Composer
  7116. {
  7117. const VERSION = '1.10.13';
  7118. const BRANCH_ALIAS_VERSION = '';
  7119. const RELEASE_DATE = '2020-09-09 11:46:34';
  7120. const SOURCE_VERSION = '';
  7121. const RUNTIME_API_VERSION = '1.0.0';
  7122. public static function getVersion()
  7123. {
  7124. if (self::VERSION === '@package_version'.'@') {
  7125. return self::SOURCE_VERSION;
  7126. }
  7127. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  7128. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  7129. }
  7130. return self::VERSION;
  7131. }
  7132. private $package;
  7133. private $locker;
  7134. private $repositoryManager;
  7135. private $downloadManager;
  7136. private $installationManager;
  7137. private $pluginManager;
  7138. private $config;
  7139. private $eventDispatcher;
  7140. private $autoloadGenerator;
  7141. private $archiveManager;
  7142. public function setPackage(RootPackageInterface $package)
  7143. {
  7144. $this->package = $package;
  7145. }
  7146. public function getPackage()
  7147. {
  7148. return $this->package;
  7149. }
  7150. public function setConfig(Config $config)
  7151. {
  7152. $this->config = $config;
  7153. }
  7154. public function getConfig()
  7155. {
  7156. return $this->config;
  7157. }
  7158. public function setLocker(Locker $locker)
  7159. {
  7160. $this->locker = $locker;
  7161. }
  7162. public function getLocker()
  7163. {
  7164. return $this->locker;
  7165. }
  7166. public function setRepositoryManager(RepositoryManager $manager)
  7167. {
  7168. $this->repositoryManager = $manager;
  7169. }
  7170. public function getRepositoryManager()
  7171. {
  7172. return $this->repositoryManager;
  7173. }
  7174. public function setDownloadManager(DownloadManager $manager)
  7175. {
  7176. $this->downloadManager = $manager;
  7177. }
  7178. public function getDownloadManager()
  7179. {
  7180. return $this->downloadManager;
  7181. }
  7182. public function setArchiveManager(ArchiveManager $manager)
  7183. {
  7184. $this->archiveManager = $manager;
  7185. }
  7186. public function getArchiveManager()
  7187. {
  7188. return $this->archiveManager;
  7189. }
  7190. public function setInstallationManager(InstallationManager $manager)
  7191. {
  7192. $this->installationManager = $manager;
  7193. }
  7194. public function getInstallationManager()
  7195. {
  7196. return $this->installationManager;
  7197. }
  7198. public function setPluginManager(PluginManager $manager)
  7199. {
  7200. $this->pluginManager = $manager;
  7201. }
  7202. public function getPluginManager()
  7203. {
  7204. return $this->pluginManager;
  7205. }
  7206. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  7207. {
  7208. $this->eventDispatcher = $eventDispatcher;
  7209. }
  7210. public function getEventDispatcher()
  7211. {
  7212. return $this->eventDispatcher;
  7213. }
  7214. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  7215. {
  7216. $this->autoloadGenerator = $autoloadGenerator;
  7217. }
  7218. public function getAutoloadGenerator()
  7219. {
  7220. return $this->autoloadGenerator;
  7221. }
  7222. }
  7223. <?php
  7224. namespace Composer;
  7225. use Composer\Config\ConfigSourceInterface;
  7226. use Composer\Downloader\TransportException;
  7227. use Composer\IO\IOInterface;
  7228. use Composer\Util\Platform;
  7229. use Composer\Util\ProcessExecutor;
  7230. class Config
  7231. {
  7232. const RELATIVE_PATHS = 1;
  7233. public static $defaultConfig = array(
  7234. 'process-timeout' => 300,
  7235. 'use-include-path' => false,
  7236. 'preferred-install' => 'auto',
  7237. 'notify-on-install' => true,
  7238. 'github-protocols' => array('https', 'ssh', 'git'),
  7239. 'vendor-dir' => 'vendor',
  7240. 'bin-dir' => '{$vendor-dir}/bin',
  7241. 'cache-dir' => '{$home}/cache',
  7242. 'data-dir' => '{$home}',
  7243. 'cache-files-dir' => '{$cache-dir}/files',
  7244. 'cache-repo-dir' => '{$cache-dir}/repo',
  7245. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  7246. 'cache-ttl' => 15552000,
  7247. 'cache-files-ttl' => null,
  7248. 'cache-files-maxsize' => '300MiB',
  7249. 'bin-compat' => 'auto',
  7250. 'discard-changes' => false,
  7251. 'autoloader-suffix' => null,
  7252. 'sort-packages' => false,
  7253. 'optimize-autoloader' => false,
  7254. 'classmap-authoritative' => false,
  7255. 'apcu-autoloader' => false,
  7256. 'prepend-autoloader' => true,
  7257. 'github-domains' => array('github.com'),
  7258. 'bitbucket-expose-hostname' => true,
  7259. 'disable-tls' => false,
  7260. 'secure-http' => true,
  7261. 'cafile' => null,
  7262. 'capath' => null,
  7263. 'github-expose-hostname' => true,
  7264. 'gitlab-domains' => array('gitlab.com'),
  7265. 'store-auths' => 'prompt',
  7266. 'platform' => array(),
  7267. 'archive-format' => 'tar',
  7268. 'archive-dir' => '.',
  7269. 'htaccess-protect' => true,
  7270. 'use-github-api' => true,
  7271. 'lock' => true,
  7272. );
  7273. public static $defaultRepositories = array(
  7274. 'packagist.org' => array(
  7275. 'type' => 'composer',
  7276. 'url' => 'https?://repo.packagist.org',
  7277. 'allow_ssl_downgrade' => true,
  7278. ),
  7279. );
  7280. private $config;
  7281. private $baseDir;
  7282. private $repositories;
  7283. private $configSource;
  7284. private $authConfigSource;
  7285. private $useEnvironment;
  7286. private $warnedHosts = array();
  7287. public function __construct($useEnvironment = true, $baseDir = null)
  7288. {
  7289. $this->config = static::$defaultConfig;
  7290. $this->repositories = static::$defaultRepositories;
  7291. $this->useEnvironment = (bool) $useEnvironment;
  7292. $this->baseDir = $baseDir;
  7293. }
  7294. public function setConfigSource(ConfigSourceInterface $source)
  7295. {
  7296. $this->configSource = $source;
  7297. }
  7298. public function getConfigSource()
  7299. {
  7300. return $this->configSource;
  7301. }
  7302. public function setAuthConfigSource(ConfigSourceInterface $source)
  7303. {
  7304. $this->authConfigSource = $source;
  7305. }
  7306. public function getAuthConfigSource()
  7307. {
  7308. return $this->authConfigSource;
  7309. }
  7310. public function merge($config)
  7311. {
  7312. if (!empty($config['config']) && is_array($config['config'])) {
  7313. foreach ($config['config'] as $key => $val) {
  7314. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer')) && isset($this->config[$key])) {
  7315. $this->config[$key] = array_merge($this->config[$key], $val);
  7316. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  7317. if (is_array($val) || is_array($this->config[$key])) {
  7318. if (is_string($val)) {
  7319. $val = array('*' => $val);
  7320. }
  7321. if (is_string($this->config[$key])) {
  7322. $this->config[$key] = array('*' => $this->config[$key]);
  7323. }
  7324. $this->config[$key] = array_merge($this->config[$key], $val);
  7325. if (isset($this->config[$key]['*'])) {
  7326. $wildcard = $this->config[$key]['*'];
  7327. unset($this->config[$key]['*']);
  7328. $this->config[$key]['*'] = $wildcard;
  7329. }
  7330. } else {
  7331. $this->config[$key] = $val;
  7332. }
  7333. } else {
  7334. $this->config[$key] = $val;
  7335. }
  7336. }
  7337. }
  7338. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  7339. $this->repositories = array_reverse($this->repositories, true);
  7340. $newRepos = array_reverse($config['repositories'], true);
  7341. foreach ($newRepos as $name => $repository) {
  7342. if (false === $repository) {
  7343. $this->disableRepoByName($name);
  7344. continue;
  7345. }
  7346. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  7347. $this->disableRepoByName(key($repository));
  7348. continue;
  7349. }
  7350. if (is_int($name)) {
  7351. $this->repositories[] = $repository;
  7352. } else {
  7353. if ($name === 'packagist') {
  7354. $this->repositories[$name . '.org'] = $repository;
  7355. } else {
  7356. $this->repositories[$name] = $repository;
  7357. }
  7358. }
  7359. }
  7360. $this->repositories = array_reverse($this->repositories, true);
  7361. }
  7362. }
  7363. public function getRepositories()
  7364. {
  7365. return $this->repositories;
  7366. }
  7367. public function get($key, $flags = 0)
  7368. {
  7369. switch ($key) {
  7370. case 'vendor-dir':
  7371. case 'bin-dir':
  7372. case 'process-timeout':
  7373. case 'data-dir':
  7374. case 'cache-dir':
  7375. case 'cache-files-dir':
  7376. case 'cache-repo-dir':
  7377. case 'cache-vcs-dir':
  7378. case 'cafile':
  7379. case 'capath':
  7380. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  7381. $val = $this->getComposerEnv($env);
  7382. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  7383. $val = Platform::expandPath($val);
  7384. if (substr($key, -4) !== '-dir') {
  7385. return $val;
  7386. }
  7387. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  7388. case 'htaccess-protect':
  7389. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  7390. if (false === $value) {
  7391. $value = $this->config[$key];
  7392. }
  7393. return $value !== 'false' && (bool) $value;
  7394. case 'cache-ttl':
  7395. return (int) $this->config[$key];
  7396. case 'cache-files-maxsize':
  7397. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  7398. throw new \RuntimeException(
  7399. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  7400. );
  7401. }
  7402. $size = $matches[1];
  7403. if (isset($matches[2])) {
  7404. switch (strtolower($matches[2])) {
  7405. case 'g':
  7406. $size *= 1024;
  7407. case 'm':
  7408. $size *= 1024;
  7409. case 'k':
  7410. $size *= 1024;
  7411. break;
  7412. }
  7413. }
  7414. return $size;
  7415. case 'cache-files-ttl':
  7416. if (isset($this->config[$key])) {
  7417. return (int) $this->config[$key];
  7418. }
  7419. return (int) $this->config['cache-ttl'];
  7420. case 'home':
  7421. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  7422. return rtrim($this->process($val, $flags), '/\\');
  7423. case 'bin-compat':
  7424. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  7425. if (!in_array($value, array('auto', 'full'))) {
  7426. throw new \RuntimeException(
  7427. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  7428. );
  7429. }
  7430. return $value;
  7431. case 'discard-changes':
  7432. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  7433. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  7434. throw new \RuntimeException(
  7435. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  7436. );
  7437. }
  7438. if ('stash' === $env) {
  7439. return 'stash';
  7440. }
  7441. return $env !== 'false' && (bool) $env;
  7442. }
  7443. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  7444. throw new \RuntimeException(
  7445. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  7446. );
  7447. }
  7448. return $this->config[$key];
  7449. case 'github-protocols':
  7450. $protos = $this->config['github-protocols'];
  7451. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  7452. unset($protos[$index]);
  7453. }
  7454. if (reset($protos) === 'http') {
  7455. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  7456. }
  7457. return $protos;
  7458. case 'disable-tls':
  7459. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7460. case 'secure-http':
  7461. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7462. case 'use-github-api':
  7463. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7464. case 'lock':
  7465. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7466. default:
  7467. if (!isset($this->config[$key])) {
  7468. return null;
  7469. }
  7470. return $this->process($this->config[$key], $flags);
  7471. }
  7472. }
  7473. public function all($flags = 0)
  7474. {
  7475. $all = array(
  7476. 'repositories' => $this->getRepositories(),
  7477. );
  7478. foreach (array_keys($this->config) as $key) {
  7479. $all['config'][$key] = $this->get($key, $flags);
  7480. }
  7481. return $all;
  7482. }
  7483. public function raw()
  7484. {
  7485. return array(
  7486. 'repositories' => $this->getRepositories(),
  7487. 'config' => $this->config,
  7488. );
  7489. }
  7490. public function has($key)
  7491. {
  7492. return array_key_exists($key, $this->config);
  7493. }
  7494. private function process($value, $flags)
  7495. {
  7496. $config = $this;
  7497. if (!is_string($value)) {
  7498. return $value;
  7499. }
  7500. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  7501. return $config->get($match[1], $flags);
  7502. }, $value);
  7503. }
  7504. private function realpath($path)
  7505. {
  7506. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  7507. return $path;
  7508. }
  7509. return $this->baseDir . '/' . $path;
  7510. }
  7511. private function getComposerEnv($var)
  7512. {
  7513. if ($this->useEnvironment) {
  7514. return getenv($var);
  7515. }
  7516. return false;
  7517. }
  7518. private function disableRepoByName($name)
  7519. {
  7520. if (isset($this->repositories[$name])) {
  7521. unset($this->repositories[$name]);
  7522. } elseif ($name === 'packagist') {
  7523. unset($this->repositories['packagist.org']);
  7524. }
  7525. }
  7526. public function prohibitUrlByConfig($url, IOInterface $io = null)
  7527. {
  7528. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  7529. return;
  7530. }
  7531. $scheme = parse_url($url, PHP_URL_SCHEME);
  7532. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  7533. if ($this->get('secure-http')) {
  7534. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  7535. } elseif ($io) {
  7536. $host = parse_url($url, PHP_URL_HOST);
  7537. if (!isset($this->warnedHosts[$host])) {
  7538. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  7539. }
  7540. $this->warnedHosts[$host] = true;
  7541. }
  7542. }
  7543. }
  7544. public static function disableProcessTimeout()
  7545. {
  7546. ProcessExecutor::setTimeout(0);
  7547. }
  7548. }
  7549. <?php
  7550. namespace Composer\Config;
  7551. interface ConfigSourceInterface
  7552. {
  7553. public function addRepository($name, $config);
  7554. public function removeRepository($name);
  7555. public function addConfigSetting($name, $value);
  7556. public function removeConfigSetting($name);
  7557. public function addProperty($name, $value);
  7558. public function removeProperty($name);
  7559. public function addLink($type, $name, $value);
  7560. public function removeLink($type, $name);
  7561. public function getName();
  7562. }
  7563. <?php
  7564. namespace Composer\Config;
  7565. use Composer\Json\JsonFile;
  7566. use Composer\Json\JsonManipulator;
  7567. use Composer\Util\Silencer;
  7568. class JsonConfigSource implements ConfigSourceInterface
  7569. {
  7570. private $file;
  7571. private $authConfig;
  7572. public function __construct(JsonFile $file, $authConfig = false)
  7573. {
  7574. $this->file = $file;
  7575. $this->authConfig = $authConfig;
  7576. }
  7577. public function getName()
  7578. {
  7579. return $this->file->getPath();
  7580. }
  7581. public function addRepository($name, $config)
  7582. {
  7583. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7584. if (isset($config['repositories'])) {
  7585. foreach ($config['repositories'] as $index => $val) {
  7586. if ($index === $repo) {
  7587. continue;
  7588. }
  7589. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7590. unset($config['repositories'][$index]);
  7591. $config['repositories']['packagist.org'] = false;
  7592. break;
  7593. }
  7594. }
  7595. }
  7596. $config['repositories'][$repo] = $repoConfig;
  7597. });
  7598. }
  7599. public function removeRepository($name)
  7600. {
  7601. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7602. unset($config['repositories'][$repo]);
  7603. });
  7604. }
  7605. public function addConfigSetting($name, $value)
  7606. {
  7607. $authConfig = $this->authConfig;
  7608. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7609. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7610. list($key, $host) = explode('.', $key, 2);
  7611. if ($authConfig) {
  7612. $config[$key][$host] = $val;
  7613. } else {
  7614. $config['config'][$key][$host] = $val;
  7615. }
  7616. } else {
  7617. $config['config'][$key] = $val;
  7618. }
  7619. });
  7620. }
  7621. public function removeConfigSetting($name)
  7622. {
  7623. $authConfig = $this->authConfig;
  7624. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7625. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7626. list($key, $host) = explode('.', $key, 2);
  7627. if ($authConfig) {
  7628. unset($config[$key][$host]);
  7629. } else {
  7630. unset($config['config'][$key][$host]);
  7631. }
  7632. } else {
  7633. unset($config['config'][$key]);
  7634. }
  7635. });
  7636. }
  7637. public function addProperty($name, $value)
  7638. {
  7639. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7640. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7641. $bits = explode('.', $key);
  7642. $last = array_pop($bits);
  7643. $arr = &$config[reset($bits)];
  7644. foreach ($bits as $bit) {
  7645. if (!isset($arr[$bit])) {
  7646. $arr[$bit] = array();
  7647. }
  7648. $arr = &$arr[$bit];
  7649. }
  7650. $arr[$last] = $val;
  7651. } else {
  7652. $config[$key] = $val;
  7653. }
  7654. });
  7655. }
  7656. public function removeProperty($name)
  7657. {
  7658. $authConfig = $this->authConfig;
  7659. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7660. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7661. $bits = explode('.', $key);
  7662. $last = array_pop($bits);
  7663. $arr = &$config[reset($bits)];
  7664. foreach ($bits as $bit) {
  7665. if (!isset($arr[$bit])) {
  7666. return;
  7667. }
  7668. $arr = &$arr[$bit];
  7669. }
  7670. unset($arr[$last]);
  7671. } else {
  7672. unset($config[$key]);
  7673. }
  7674. });
  7675. }
  7676. public function addLink($type, $name, $value)
  7677. {
  7678. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7679. $config[$type][$name] = $value;
  7680. });
  7681. }
  7682. public function removeLink($type, $name)
  7683. {
  7684. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7685. unset($config[$type][$name]);
  7686. if (0 === count($config[$type])) {
  7687. unset($config[$type]);
  7688. }
  7689. });
  7690. }
  7691. protected function manipulateJson($method, $args, $fallback)
  7692. {
  7693. $args = func_get_args();
  7694. array_shift($args);
  7695. $fallback = array_pop($args);
  7696. if ($this->file->exists()) {
  7697. if (!is_writable($this->file->getPath())) {
  7698. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7699. }
  7700. if (!is_readable($this->file->getPath())) {
  7701. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7702. }
  7703. $contents = file_get_contents($this->file->getPath());
  7704. } elseif ($this->authConfig) {
  7705. $contents = "{\n}\n";
  7706. } else {
  7707. $contents = "{\n \"config\": {\n }\n}\n";
  7708. }
  7709. $manipulator = new JsonManipulator($contents);
  7710. $newFile = !$this->file->exists();
  7711. if ($this->authConfig && $method === 'addConfigSetting') {
  7712. $method = 'addSubNode';
  7713. list($mainNode, $name) = explode('.', $args[0], 2);
  7714. $args = array($mainNode, $name, $args[1]);
  7715. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7716. $method = 'removeSubNode';
  7717. list($mainNode, $name) = explode('.', $args[0], 2);
  7718. $args = array($mainNode, $name);
  7719. }
  7720. if (call_user_func_array(array($manipulator, $method), $args)) {
  7721. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7722. } else {
  7723. $config = $this->file->read();
  7724. $this->arrayUnshiftRef($args, $config);
  7725. call_user_func_array($fallback, $args);
  7726. foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev') as $linkType) {
  7727. if (isset($config[$linkType]) && $config[$linkType] === array()) {
  7728. $config[$linkType] = new \stdClass;
  7729. }
  7730. }
  7731. $this->file->write($config);
  7732. }
  7733. if ($newFile) {
  7734. Silencer::call('chmod', $this->file->getPath(), 0600);
  7735. }
  7736. }
  7737. private function arrayUnshiftRef(&$array, &$value)
  7738. {
  7739. $return = array_unshift($array, '');
  7740. $array[0] = &$value;
  7741. return $return;
  7742. }
  7743. }
  7744. <?php
  7745. namespace Composer\Console;
  7746. use Composer\IO\NullIO;
  7747. use Composer\Util\Platform;
  7748. use Composer\Util\Silencer;
  7749. use Symfony\Component\Console\Application as BaseApplication;
  7750. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7751. use Symfony\Component\Console\Helper\HelperSet;
  7752. use Symfony\Component\Console\Helper\QuestionHelper;
  7753. use Symfony\Component\Console\Input\InputInterface;
  7754. use Symfony\Component\Console\Input\InputOption;
  7755. use Symfony\Component\Console\Output\OutputInterface;
  7756. use Composer\Command;
  7757. use Composer\Composer;
  7758. use Composer\Factory;
  7759. use Composer\IO\IOInterface;
  7760. use Composer\IO\ConsoleIO;
  7761. use Composer\Json\JsonValidationException;
  7762. use Composer\Util\ErrorHandler;
  7763. use Composer\EventDispatcher\ScriptExecutionException;
  7764. use Composer\Exception\NoSslException;
  7765. class Application extends BaseApplication
  7766. {
  7767. protected $composer;
  7768. protected $io;
  7769. private static $logo = ' ______
  7770. / ____/___ ____ ___ ____ ____ ________ _____
  7771. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7772. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7773. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7774. /_/
  7775. ';
  7776. private $hasPluginCommands = false;
  7777. private $disablePluginsByDefault = false;
  7778. private $initialWorkingDirectory = '';
  7779. public function __construct()
  7780. {
  7781. static $shutdownRegistered = false;
  7782. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7783. ini_set('xdebug.show_exception_trace', false);
  7784. ini_set('xdebug.scream', false);
  7785. }
  7786. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7787. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7788. }
  7789. if (!$shutdownRegistered) {
  7790. $shutdownRegistered = true;
  7791. register_shutdown_function(function () {
  7792. $lastError = error_get_last();
  7793. if ($lastError && $lastError['message'] &&
  7794. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7795. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7796. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7797. }
  7798. });
  7799. }
  7800. $this->io = new NullIO();
  7801. $this->initialWorkingDirectory = getcwd();
  7802. parent::__construct('Composer', Composer::getVersion());
  7803. }
  7804. public function run(InputInterface $input = null, OutputInterface $output = null)
  7805. {
  7806. if (null === $output) {
  7807. $output = Factory::createOutput();
  7808. }
  7809. return parent::run($input, $output);
  7810. }
  7811. public function doRun(InputInterface $input, OutputInterface $output)
  7812. {
  7813. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7814. if (getenv('COMPOSER_NO_INTERACTION')) {
  7815. $input->setInteractive(false);
  7816. }
  7817. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7818. new QuestionHelper(),
  7819. )));
  7820. ErrorHandler::register($io);
  7821. if ($input->hasParameterOption('--no-cache')) {
  7822. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7823. $_SERVER['COMPOSER_CACHE_DIR'] = Platform::isWindows() ? 'nul' : '/dev/null';
  7824. putenv('COMPOSER_CACHE_DIR='.$_SERVER['COMPOSER_CACHE_DIR']);
  7825. }
  7826. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7827. $oldWorkingDir = getcwd();
  7828. chdir($newWorkDir);
  7829. $this->initialWorkingDirectory = $newWorkDir;
  7830. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7831. }
  7832. $commandName = '';
  7833. if ($name = $this->getCommandName($input)) {
  7834. try {
  7835. $commandName = $this->find($name)->getName();
  7836. } catch (CommandNotFoundException $e) {
  7837. $commandName = false;
  7838. } catch (\InvalidArgumentException $e) {
  7839. }
  7840. }
  7841. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile())) {
  7842. $dir = dirname(getcwd());
  7843. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7844. while (dirname($dir) !== $dir && $dir !== $home) {
  7845. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7846. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7847. $oldWorkingDir = getcwd();
  7848. chdir($dir);
  7849. }
  7850. break;
  7851. }
  7852. $dir = dirname($dir);
  7853. }
  7854. }
  7855. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7856. try {
  7857. foreach ($this->getPluginCommands() as $command) {
  7858. if ($this->has($command->getName())) {
  7859. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7860. } else {
  7861. $this->add($command);
  7862. }
  7863. }
  7864. } catch (NoSslException $e) {
  7865. }
  7866. $this->hasPluginCommands = true;
  7867. }
  7868. $isProxyCommand = false;
  7869. if ($name = $this->getCommandName($input)) {
  7870. try {
  7871. $command = $this->find($name);
  7872. $commandName = $command->getName();
  7873. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7874. } catch (\InvalidArgumentException $e) {
  7875. }
  7876. }
  7877. if (!$isProxyCommand) {
  7878. $io->writeError(sprintf(
  7879. 'Running %s (%s) with %s on %s',
  7880. Composer::getVersion(),
  7881. Composer::RELEASE_DATE,
  7882. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7883. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7884. ), true, IOInterface::DEBUG);
  7885. if (PHP_VERSION_ID < 50302) {
  7886. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7887. }
  7888. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7889. $io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7890. }
  7891. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7892. $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']));
  7893. }
  7894. if (
  7895. !Platform::isWindows()
  7896. && function_exists('exec')
  7897. && !getenv('COMPOSER_ALLOW_SUPERUSER')
  7898. && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
  7899. ) {
  7900. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7901. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7902. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7903. }
  7904. if ($uid = (int) getenv('SUDO_UID')) {
  7905. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7906. }
  7907. }
  7908. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7909. }
  7910. Silencer::call(function () use ($io) {
  7911. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7912. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7913. $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()));
  7914. }
  7915. });
  7916. $file = Factory::getComposerFile();
  7917. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7918. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7919. foreach ($composer['scripts'] as $script => $dummy) {
  7920. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7921. if ($this->has($script)) {
  7922. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7923. } else {
  7924. $description = null;
  7925. if (isset($composer['scripts-descriptions'][$script])) {
  7926. $description = $composer['scripts-descriptions'][$script];
  7927. }
  7928. $this->add(new Command\ScriptAliasCommand($script, $description));
  7929. }
  7930. }
  7931. }
  7932. }
  7933. }
  7934. }
  7935. try {
  7936. if ($input->hasParameterOption('--profile')) {
  7937. $startTime = microtime(true);
  7938. $this->io->enableDebugging($startTime);
  7939. }
  7940. $result = parent::doRun($input, $output);
  7941. if (isset($oldWorkingDir)) {
  7942. chdir($oldWorkingDir);
  7943. }
  7944. if (isset($startTime)) {
  7945. $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');
  7946. }
  7947. restore_error_handler();
  7948. return $result;
  7949. } catch (ScriptExecutionException $e) {
  7950. return $e->getCode();
  7951. } catch (\Exception $e) {
  7952. $this->hintCommonErrors($e);
  7953. restore_error_handler();
  7954. throw $e;
  7955. }
  7956. }
  7957. private function getNewWorkingDir(InputInterface $input)
  7958. {
  7959. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7960. if (false !== $workingDir && !is_dir($workingDir)) {
  7961. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7962. }
  7963. return $workingDir;
  7964. }
  7965. private function hintCommonErrors($exception)
  7966. {
  7967. $io = $this->getIO();
  7968. Silencer::suppress();
  7969. try {
  7970. $composer = $this->getComposer(false, true);
  7971. if ($composer) {
  7972. $config = $composer->getConfig();
  7973. $minSpaceFree = 1024 * 1024;
  7974. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7975. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7976. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7977. ) {
  7978. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7979. }
  7980. }
  7981. } catch (\Exception $e) {
  7982. }
  7983. Silencer::restore();
  7984. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7985. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7986. $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);
  7987. }
  7988. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7989. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7990. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7991. }
  7992. }
  7993. public function getComposer($required = true, $disablePlugins = null)
  7994. {
  7995. if (null === $disablePlugins) {
  7996. $disablePlugins = $this->disablePluginsByDefault;
  7997. }
  7998. if (null === $this->composer) {
  7999. try {
  8000. $this->composer = Factory::create($this->io, null, $disablePlugins);
  8001. } catch (\InvalidArgumentException $e) {
  8002. if ($required) {
  8003. $this->io->writeError($e->getMessage());
  8004. exit(1);
  8005. }
  8006. } catch (JsonValidationException $e) {
  8007. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  8008. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  8009. throw new JsonValidationException($message);
  8010. }
  8011. }
  8012. return $this->composer;
  8013. }
  8014. public function resetComposer()
  8015. {
  8016. $this->composer = null;
  8017. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  8018. $this->getIO()->resetAuthentications();
  8019. }
  8020. }
  8021. public function getIO()
  8022. {
  8023. return $this->io;
  8024. }
  8025. public function getHelp()
  8026. {
  8027. return self::$logo . parent::getHelp();
  8028. }
  8029. protected function getDefaultCommands()
  8030. {
  8031. $commands = array_merge(parent::getDefaultCommands(), array(
  8032. new Command\AboutCommand(),
  8033. new Command\ConfigCommand(),
  8034. new Command\DependsCommand(),
  8035. new Command\ProhibitsCommand(),
  8036. new Command\InitCommand(),
  8037. new Command\InstallCommand(),
  8038. new Command\CreateProjectCommand(),
  8039. new Command\UpdateCommand(),
  8040. new Command\SearchCommand(),
  8041. new Command\ValidateCommand(),
  8042. new Command\ShowCommand(),
  8043. new Command\SuggestsCommand(),
  8044. new Command\RequireCommand(),
  8045. new Command\DumpAutoloadCommand(),
  8046. new Command\StatusCommand(),
  8047. new Command\ArchiveCommand(),
  8048. new Command\DiagnoseCommand(),
  8049. new Command\RunScriptCommand(),
  8050. new Command\LicensesCommand(),
  8051. new Command\GlobalCommand(),
  8052. new Command\ClearCacheCommand(),
  8053. new Command\RemoveCommand(),
  8054. new Command\HomeCommand(),
  8055. new Command\ExecCommand(),
  8056. new Command\OutdatedCommand(),
  8057. new Command\CheckPlatformReqsCommand(),
  8058. new Command\FundCommand(),
  8059. ));
  8060. if ('phar:' === substr(__FILE__, 0, 5)) {
  8061. $commands[] = new Command\SelfUpdateCommand();
  8062. }
  8063. return $commands;
  8064. }
  8065. public function getLongVersion()
  8066. {
  8067. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  8068. return sprintf(
  8069. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  8070. $this->getName(),
  8071. Composer::BRANCH_ALIAS_VERSION,
  8072. $this->getVersion(),
  8073. Composer::RELEASE_DATE
  8074. );
  8075. }
  8076. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  8077. }
  8078. protected function getDefaultInputDefinition()
  8079. {
  8080. $definition = parent::getDefaultInputDefinition();
  8081. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  8082. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  8083. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  8084. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  8085. return $definition;
  8086. }
  8087. private function getPluginCommands()
  8088. {
  8089. $commands = array();
  8090. $composer = $this->getComposer(false, false);
  8091. if (null === $composer) {
  8092. $composer = Factory::createGlobal($this->io, false);
  8093. }
  8094. if (null !== $composer) {
  8095. $pm = $composer->getPluginManager();
  8096. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  8097. $newCommands = $capability->getCommands();
  8098. if (!is_array($newCommands)) {
  8099. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  8100. }
  8101. foreach ($newCommands as $command) {
  8102. if (!$command instanceof Command\BaseCommand) {
  8103. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  8104. }
  8105. }
  8106. $commands = array_merge($commands, $newCommands);
  8107. }
  8108. }
  8109. return $commands;
  8110. }
  8111. public function getInitialWorkingDirectory()
  8112. {
  8113. return $this->initialWorkingDirectory;
  8114. }
  8115. }
  8116. <?php
  8117. namespace Composer\Console;
  8118. use Symfony\Component\Console\Formatter\OutputFormatter;
  8119. class HtmlOutputFormatter extends OutputFormatter
  8120. {
  8121. private static $availableForegroundColors = array(
  8122. 30 => 'black',
  8123. 31 => 'red',
  8124. 32 => 'green',
  8125. 33 => 'yellow',
  8126. 34 => 'blue',
  8127. 35 => 'magenta',
  8128. 36 => 'cyan',
  8129. 37 => 'white',
  8130. );
  8131. private static $availableBackgroundColors = array(
  8132. 40 => 'black',
  8133. 41 => 'red',
  8134. 42 => 'green',
  8135. 43 => 'yellow',
  8136. 44 => 'blue',
  8137. 45 => 'magenta',
  8138. 46 => 'cyan',
  8139. 47 => 'white',
  8140. );
  8141. private static $availableOptions = array(
  8142. 1 => 'bold',
  8143. 4 => 'underscore',
  8144. );
  8145. public function __construct(array $styles = array())
  8146. {
  8147. parent::__construct(true, $styles);
  8148. }
  8149. public function format($message)
  8150. {
  8151. $formatted = parent::format($message);
  8152. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  8153. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  8154. }
  8155. private function formatHtml($matches)
  8156. {
  8157. $out = '<span style="';
  8158. foreach (explode(';', $matches[1]) as $code) {
  8159. if (isset(self::$availableForegroundColors[$code])) {
  8160. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  8161. } elseif (isset(self::$availableBackgroundColors[$code])) {
  8162. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  8163. } elseif (isset(self::$availableOptions[$code])) {
  8164. switch (self::$availableOptions[$code]) {
  8165. case 'bold':
  8166. $out .= 'font-weight:bold;';
  8167. break;
  8168. case 'underscore':
  8169. $out .= 'text-decoration:underline;';
  8170. break;
  8171. }
  8172. }
  8173. }
  8174. return $out.'">'.$matches[2].'</span>';
  8175. }
  8176. }
  8177. <?php
  8178. namespace Composer\DependencyResolver;
  8179. class Decisions implements \Iterator, \Countable
  8180. {
  8181. const DECISION_LITERAL = 0;
  8182. const DECISION_REASON = 1;
  8183. protected $pool;
  8184. protected $decisionMap;
  8185. protected $decisionQueue = array();
  8186. public function __construct($pool)
  8187. {
  8188. $this->pool = $pool;
  8189. $this->decisionMap = array();
  8190. }
  8191. public function decide($literal, $level, $why)
  8192. {
  8193. $this->addDecision($literal, $level);
  8194. $this->decisionQueue[] = array(
  8195. self::DECISION_LITERAL => $literal,
  8196. self::DECISION_REASON => $why,
  8197. );
  8198. }
  8199. public function satisfy($literal)
  8200. {
  8201. $packageId = abs($literal);
  8202. return (
  8203. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  8204. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  8205. );
  8206. }
  8207. public function conflict($literal)
  8208. {
  8209. $packageId = abs($literal);
  8210. return (
  8211. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  8212. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  8213. );
  8214. }
  8215. public function decided($literalOrPackageId)
  8216. {
  8217. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  8218. }
  8219. public function undecided($literalOrPackageId)
  8220. {
  8221. return empty($this->decisionMap[abs($literalOrPackageId)]);
  8222. }
  8223. public function decidedInstall($literalOrPackageId)
  8224. {
  8225. $packageId = abs($literalOrPackageId);
  8226. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  8227. }
  8228. public function decisionLevel($literalOrPackageId)
  8229. {
  8230. $packageId = abs($literalOrPackageId);
  8231. if (isset($this->decisionMap[$packageId])) {
  8232. return abs($this->decisionMap[$packageId]);
  8233. }
  8234. return 0;
  8235. }
  8236. public function decisionRule($literalOrPackageId)
  8237. {
  8238. $packageId = abs($literalOrPackageId);
  8239. foreach ($this->decisionQueue as $i => $decision) {
  8240. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  8241. return $decision[self::DECISION_REASON];
  8242. }
  8243. }
  8244. return null;
  8245. }
  8246. public function atOffset($queueOffset)
  8247. {
  8248. return $this->decisionQueue[$queueOffset];
  8249. }
  8250. public function validOffset($queueOffset)
  8251. {
  8252. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  8253. }
  8254. public function lastReason()
  8255. {
  8256. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  8257. }
  8258. public function lastLiteral()
  8259. {
  8260. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  8261. }
  8262. public function reset()
  8263. {
  8264. while ($decision = array_pop($this->decisionQueue)) {
  8265. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8266. }
  8267. }
  8268. public function resetToOffset($offset)
  8269. {
  8270. while (count($this->decisionQueue) > $offset + 1) {
  8271. $decision = array_pop($this->decisionQueue);
  8272. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8273. }
  8274. }
  8275. public function revertLast()
  8276. {
  8277. $this->decisionMap[abs($this->lastLiteral())] = 0;
  8278. array_pop($this->decisionQueue);
  8279. }
  8280. public function count()
  8281. {
  8282. return count($this->decisionQueue);
  8283. }
  8284. public function rewind()
  8285. {
  8286. end($this->decisionQueue);
  8287. }
  8288. public function current()
  8289. {
  8290. return current($this->decisionQueue);
  8291. }
  8292. public function key()
  8293. {
  8294. return key($this->decisionQueue);
  8295. }
  8296. public function next()
  8297. {
  8298. return prev($this->decisionQueue);
  8299. }
  8300. public function valid()
  8301. {
  8302. return false !== current($this->decisionQueue);
  8303. }
  8304. public function isEmpty()
  8305. {
  8306. return count($this->decisionQueue) === 0;
  8307. }
  8308. protected function addDecision($literal, $level)
  8309. {
  8310. $packageId = abs($literal);
  8311. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  8312. if ($previousDecision != 0) {
  8313. $literalString = $this->pool->literalToPrettyString($literal, array());
  8314. $package = $this->pool->literalToPackage($literal);
  8315. throw new SolverBugException(
  8316. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  8317. );
  8318. }
  8319. if ($literal > 0) {
  8320. $this->decisionMap[$packageId] = $level;
  8321. } else {
  8322. $this->decisionMap[$packageId] = -$level;
  8323. }
  8324. }
  8325. public function __toString()
  8326. {
  8327. $decisionMap = $this->decisionMap;
  8328. ksort($decisionMap);
  8329. $str = '[';
  8330. foreach ($decisionMap as $packageId => $level) {
  8331. $str .= $packageId.':'.$level.',';
  8332. }
  8333. $str .= ']';
  8334. return $str;
  8335. }
  8336. }
  8337. <?php
  8338. namespace Composer\DependencyResolver;
  8339. use Composer\Package\PackageInterface;
  8340. use Composer\Package\AliasPackage;
  8341. use Composer\Package\BasePackage;
  8342. use Composer\Semver\Constraint\Constraint;
  8343. class DefaultPolicy implements PolicyInterface
  8344. {
  8345. private $preferStable;
  8346. private $preferLowest;
  8347. public function __construct($preferStable = false, $preferLowest = false)
  8348. {
  8349. $this->preferStable = $preferStable;
  8350. $this->preferLowest = $preferLowest;
  8351. }
  8352. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  8353. {
  8354. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  8355. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  8356. }
  8357. $constraint = new Constraint($operator, $b->getVersion());
  8358. $version = new Constraint('==', $a->getVersion());
  8359. return $constraint->matchSpecific($version, true);
  8360. }
  8361. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  8362. {
  8363. $packages = array();
  8364. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  8365. if ($candidate !== $package) {
  8366. $packages[] = $candidate;
  8367. }
  8368. }
  8369. return $packages;
  8370. }
  8371. public function getPriority(Pool $pool, PackageInterface $package)
  8372. {
  8373. return $pool->getPriority($package->getRepository());
  8374. }
  8375. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  8376. {
  8377. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  8378. foreach ($packages as &$literals) {
  8379. $policy = $this;
  8380. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8381. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  8382. });
  8383. }
  8384. foreach ($packages as &$literals) {
  8385. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  8386. $literals = $this->pruneToBestVersion($pool, $literals);
  8387. $literals = $this->pruneRemoteAliases($pool, $literals);
  8388. }
  8389. $selected = call_user_func_array('array_merge', array_values($packages));
  8390. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8391. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  8392. });
  8393. return $selected;
  8394. }
  8395. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  8396. {
  8397. $packages = array();
  8398. foreach ($literals as $literal) {
  8399. $packageName = $pool->literalToPackage($literal)->getName();
  8400. if (!isset($packages[$packageName])) {
  8401. $packages[$packageName] = array();
  8402. }
  8403. if (isset($installedMap[abs($literal)])) {
  8404. array_unshift($packages[$packageName], $literal);
  8405. } else {
  8406. $packages[$packageName][] = $literal;
  8407. }
  8408. }
  8409. return $packages;
  8410. }
  8411. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  8412. {
  8413. if ($a->getRepository() === $b->getRepository()) {
  8414. if ($a->getName() === $b->getName()) {
  8415. $aAliased = $a instanceof AliasPackage;
  8416. $bAliased = $b instanceof AliasPackage;
  8417. if ($aAliased && !$bAliased) {
  8418. return -1;
  8419. }
  8420. if (!$aAliased && $bAliased) {
  8421. return 1;
  8422. }
  8423. }
  8424. if (!$ignoreReplace) {
  8425. if ($this->replaces($a, $b)) {
  8426. return 1;
  8427. }
  8428. if ($this->replaces($b, $a)) {
  8429. return -1;
  8430. }
  8431. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  8432. $requiredVendor = substr($requiredPackage, 0, $pos);
  8433. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  8434. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  8435. if ($bIsSameVendor !== $aIsSameVendor) {
  8436. return $aIsSameVendor ? -1 : 1;
  8437. }
  8438. }
  8439. }
  8440. if ($a->id === $b->id) {
  8441. return 0;
  8442. }
  8443. return ($a->id < $b->id) ? -1 : 1;
  8444. }
  8445. if (isset($installedMap[$a->id])) {
  8446. return -1;
  8447. }
  8448. if (isset($installedMap[$b->id])) {
  8449. return 1;
  8450. }
  8451. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  8452. }
  8453. protected function replaces(PackageInterface $source, PackageInterface $target)
  8454. {
  8455. foreach ($source->getReplaces() as $link) {
  8456. if ($link->getTarget() === $target->getName()
  8457. ) {
  8458. return true;
  8459. }
  8460. }
  8461. return false;
  8462. }
  8463. protected function pruneToBestVersion(Pool $pool, $literals)
  8464. {
  8465. $operator = $this->preferLowest ? '<' : '>';
  8466. $bestLiterals = array($literals[0]);
  8467. $bestPackage = $pool->literalToPackage($literals[0]);
  8468. foreach ($literals as $i => $literal) {
  8469. if (0 === $i) {
  8470. continue;
  8471. }
  8472. $package = $pool->literalToPackage($literal);
  8473. if ($this->versionCompare($package, $bestPackage, $operator)) {
  8474. $bestPackage = $package;
  8475. $bestLiterals = array($literal);
  8476. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  8477. $bestLiterals[] = $literal;
  8478. }
  8479. }
  8480. return $bestLiterals;
  8481. }
  8482. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  8483. {
  8484. $selected = array();
  8485. $priority = null;
  8486. foreach ($literals as $literal) {
  8487. $package = $pool->literalToPackage($literal);
  8488. if (isset($installedMap[$package->id])) {
  8489. $selected[] = $literal;
  8490. continue;
  8491. }
  8492. if (null === $priority) {
  8493. $priority = $this->getPriority($pool, $package);
  8494. }
  8495. if ($this->getPriority($pool, $package) != $priority) {
  8496. break;
  8497. }
  8498. $selected[] = $literal;
  8499. }
  8500. return $selected;
  8501. }
  8502. protected function pruneRemoteAliases(Pool $pool, array $literals)
  8503. {
  8504. $hasLocalAlias = false;
  8505. foreach ($literals as $literal) {
  8506. $package = $pool->literalToPackage($literal);
  8507. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8508. $hasLocalAlias = true;
  8509. break;
  8510. }
  8511. }
  8512. if (!$hasLocalAlias) {
  8513. return $literals;
  8514. }
  8515. $selected = array();
  8516. foreach ($literals as $literal) {
  8517. $package = $pool->literalToPackage($literal);
  8518. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8519. $selected[] = $literal;
  8520. }
  8521. }
  8522. return $selected;
  8523. }
  8524. }
  8525. <?php
  8526. namespace Composer\DependencyResolver;
  8527. use Composer\Package\PackageInterface;
  8528. use Composer\Package\Link;
  8529. class GenericRule extends Rule
  8530. {
  8531. protected $literals;
  8532. public function __construct(array $literals, $reason, $reasonData, $job = null)
  8533. {
  8534. parent::__construct($reason, $reasonData, $job);
  8535. sort($literals);
  8536. $this->literals = $literals;
  8537. }
  8538. public function getLiterals()
  8539. {
  8540. return $this->literals;
  8541. }
  8542. public function getHash()
  8543. {
  8544. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  8545. return $data['hash'];
  8546. }
  8547. public function equals(Rule $rule)
  8548. {
  8549. return $this->literals === $rule->getLiterals();
  8550. }
  8551. public function isAssertion()
  8552. {
  8553. return 1 === count($this->literals);
  8554. }
  8555. public function __toString()
  8556. {
  8557. $result = $this->isDisabled() ? 'disabled(' : '(';
  8558. foreach ($this->literals as $i => $literal) {
  8559. if ($i != 0) {
  8560. $result .= '|';
  8561. }
  8562. $result .= $literal;
  8563. }
  8564. $result .= ')';
  8565. return $result;
  8566. }
  8567. }
  8568. <?php
  8569. namespace Composer\DependencyResolver\Operation;
  8570. use Composer\Package\PackageInterface;
  8571. class InstallOperation extends SolverOperation
  8572. {
  8573. protected $package;
  8574. public function __construct(PackageInterface $package, $reason = null)
  8575. {
  8576. parent::__construct($reason);
  8577. $this->package = $package;
  8578. }
  8579. public function getPackage()
  8580. {
  8581. return $this->package;
  8582. }
  8583. public function getJobType()
  8584. {
  8585. return 'install';
  8586. }
  8587. public function __toString()
  8588. {
  8589. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8590. }
  8591. }
  8592. <?php
  8593. namespace Composer\DependencyResolver\Operation;
  8594. use Composer\Package\AliasPackage;
  8595. use Composer\Package\PackageInterface;
  8596. class MarkAliasInstalledOperation extends SolverOperation
  8597. {
  8598. protected $package;
  8599. public function __construct(AliasPackage $package, $reason = null)
  8600. {
  8601. parent::__construct($reason);
  8602. $this->package = $package;
  8603. }
  8604. public function getPackage()
  8605. {
  8606. return $this->package;
  8607. }
  8608. public function getJobType()
  8609. {
  8610. return 'markAliasInstalled';
  8611. }
  8612. public function __toString()
  8613. {
  8614. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8615. }
  8616. }
  8617. <?php
  8618. namespace Composer\DependencyResolver\Operation;
  8619. use Composer\Package\AliasPackage;
  8620. use Composer\Package\PackageInterface;
  8621. class MarkAliasUninstalledOperation extends SolverOperation
  8622. {
  8623. protected $package;
  8624. public function __construct(AliasPackage $package, $reason = null)
  8625. {
  8626. parent::__construct($reason);
  8627. $this->package = $package;
  8628. }
  8629. public function getPackage()
  8630. {
  8631. return $this->package;
  8632. }
  8633. public function getJobType()
  8634. {
  8635. return 'markAliasUninstalled';
  8636. }
  8637. public function __toString()
  8638. {
  8639. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8640. }
  8641. }
  8642. <?php
  8643. namespace Composer\DependencyResolver\Operation;
  8644. interface OperationInterface
  8645. {
  8646. public function getJobType();
  8647. public function getReason();
  8648. public function __toString();
  8649. }
  8650. <?php
  8651. namespace Composer\DependencyResolver\Operation;
  8652. use Composer\Package\PackageInterface;
  8653. abstract class SolverOperation implements OperationInterface
  8654. {
  8655. protected $reason;
  8656. public function __construct($reason = null)
  8657. {
  8658. $this->reason = $reason;
  8659. }
  8660. public function getReason()
  8661. {
  8662. return $this->reason;
  8663. }
  8664. protected function formatVersion(PackageInterface $package)
  8665. {
  8666. return $package->getFullPrettyVersion();
  8667. }
  8668. }
  8669. <?php
  8670. namespace Composer\DependencyResolver\Operation;
  8671. use Composer\Package\PackageInterface;
  8672. class UninstallOperation extends SolverOperation
  8673. {
  8674. protected $package;
  8675. public function __construct(PackageInterface $package, $reason = null)
  8676. {
  8677. parent::__construct($reason);
  8678. $this->package = $package;
  8679. }
  8680. public function getPackage()
  8681. {
  8682. return $this->package;
  8683. }
  8684. public function getJobType()
  8685. {
  8686. return 'uninstall';
  8687. }
  8688. public function __toString()
  8689. {
  8690. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8691. }
  8692. }
  8693. <?php
  8694. namespace Composer\DependencyResolver\Operation;
  8695. use Composer\Package\PackageInterface;
  8696. use Composer\Package\Version\VersionParser;
  8697. class UpdateOperation extends SolverOperation
  8698. {
  8699. protected $initialPackage;
  8700. protected $targetPackage;
  8701. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8702. {
  8703. parent::__construct($reason);
  8704. $this->initialPackage = $initial;
  8705. $this->targetPackage = $target;
  8706. }
  8707. public function getInitialPackage()
  8708. {
  8709. return $this->initialPackage;
  8710. }
  8711. public function getTargetPackage()
  8712. {
  8713. return $this->targetPackage;
  8714. }
  8715. public function getJobType()
  8716. {
  8717. return 'update';
  8718. }
  8719. public function __toString()
  8720. {
  8721. $actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Updating' : 'Downgrading';
  8722. return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8723. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8724. }
  8725. }
  8726. <?php
  8727. namespace Composer\DependencyResolver;
  8728. use Composer\Package\PackageInterface;
  8729. interface PolicyInterface
  8730. {
  8731. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8732. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8733. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8734. }
  8735. <?php
  8736. namespace Composer\DependencyResolver;
  8737. use Composer\Package\BasePackage;
  8738. use Composer\Package\AliasPackage;
  8739. use Composer\Package\Version\VersionParser;
  8740. use Composer\Semver\Constraint\ConstraintInterface;
  8741. use Composer\Semver\Constraint\Constraint;
  8742. use Composer\Semver\Constraint\EmptyConstraint;
  8743. use Composer\Repository\RepositoryInterface;
  8744. use Composer\Repository\CompositeRepository;
  8745. use Composer\Repository\ComposerRepository;
  8746. use Composer\Repository\InstalledRepositoryInterface;
  8747. use Composer\Repository\PlatformRepository;
  8748. use Composer\Package\PackageInterface;
  8749. class Pool implements \Countable
  8750. {
  8751. const MATCH_NAME = -1;
  8752. const MATCH_NONE = 0;
  8753. const MATCH = 1;
  8754. const MATCH_PROVIDE = 2;
  8755. const MATCH_REPLACE = 3;
  8756. const MATCH_FILTERED = 4;
  8757. protected $repositories = array();
  8758. protected $providerRepos = array();
  8759. protected $packages = array();
  8760. protected $packageByName = array();
  8761. protected $packageByExactName = array();
  8762. protected $acceptableStabilities;
  8763. protected $stabilityFlags;
  8764. protected $versionParser;
  8765. protected $providerCache = array();
  8766. protected $filterRequires;
  8767. protected $whitelist = null;
  8768. protected $id = 1;
  8769. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8770. {
  8771. $this->versionParser = new VersionParser;
  8772. $this->acceptableStabilities = array();
  8773. foreach (BasePackage::$stabilities as $stability => $value) {
  8774. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8775. $this->acceptableStabilities[$stability] = $value;
  8776. }
  8777. }
  8778. $this->stabilityFlags = $stabilityFlags;
  8779. $this->filterRequires = $filterRequires;
  8780. foreach ($filterRequires as $name => $constraint) {
  8781. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8782. unset($this->filterRequires[$name]);
  8783. }
  8784. }
  8785. }
  8786. public function setAllowList($allowList)
  8787. {
  8788. $this->setWhitelist($allowList);
  8789. }
  8790. public function setWhitelist($whitelist)
  8791. {
  8792. $this->whitelist = $whitelist;
  8793. $this->providerCache = array();
  8794. }
  8795. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8796. {
  8797. if ($repo instanceof CompositeRepository) {
  8798. $repos = $repo->getRepositories();
  8799. } else {
  8800. $repos = array($repo);
  8801. }
  8802. foreach ($repos as $repo) {
  8803. $this->repositories[] = $repo;
  8804. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8805. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8806. $this->providerRepos[] = $repo;
  8807. $repo->setRootAliases($rootAliases);
  8808. $repo->resetPackageIds();
  8809. } else {
  8810. foreach ($repo->getPackages() as $package) {
  8811. $names = $package->getNames();
  8812. $stability = $package->getStability();
  8813. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8814. $package->setId($this->id++);
  8815. $this->packages[] = $package;
  8816. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8817. foreach ($names as $provided) {
  8818. $this->packageByName[$provided][] = $package;
  8819. }
  8820. $name = $package->getName();
  8821. if (isset($rootAliases[$name][$package->getVersion()])) {
  8822. $alias = $rootAliases[$name][$package->getVersion()];
  8823. if ($package instanceof AliasPackage) {
  8824. $package = $package->getAliasOf();
  8825. }
  8826. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8827. $aliasPackage->setRootPackageAlias(true);
  8828. $aliasPackage->setId($this->id++);
  8829. $package->getRepository()->addPackage($aliasPackage);
  8830. $this->packages[] = $aliasPackage;
  8831. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8832. foreach ($aliasPackage->getNames() as $name) {
  8833. $this->packageByName[$name][] = $aliasPackage;
  8834. }
  8835. }
  8836. }
  8837. }
  8838. }
  8839. }
  8840. }
  8841. public function getPriority(RepositoryInterface $repo)
  8842. {
  8843. $priority = array_search($repo, $this->repositories, true);
  8844. if (false === $priority) {
  8845. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8846. }
  8847. return -$priority;
  8848. }
  8849. public function packageById($id)
  8850. {
  8851. return $this->packages[$id - 1];
  8852. }
  8853. public function count()
  8854. {
  8855. return count($this->packages);
  8856. }
  8857. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8858. {
  8859. if ($bypassFilters) {
  8860. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8861. }
  8862. $key = ((int) $mustMatchName).$constraint;
  8863. if (isset($this->providerCache[$name][$key])) {
  8864. return $this->providerCache[$name][$key];
  8865. }
  8866. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8867. }
  8868. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8869. {
  8870. $candidates = array();
  8871. foreach ($this->providerRepos as $repo) {
  8872. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8873. $candidates[] = $candidate;
  8874. if ($candidate->id < 1) {
  8875. $candidate->setId($this->id++);
  8876. $this->packages[$this->id - 2] = $candidate;
  8877. }
  8878. }
  8879. }
  8880. if ($mustMatchName) {
  8881. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8882. return $candidate->getName() == $name;
  8883. });
  8884. if (isset($this->packageByExactName[$name])) {
  8885. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8886. }
  8887. } elseif (isset($this->packageByName[$name])) {
  8888. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8889. }
  8890. $matches = $provideMatches = array();
  8891. $nameMatch = false;
  8892. foreach ($candidates as $candidate) {
  8893. $aliasOfCandidate = null;
  8894. if ($candidate instanceof AliasPackage) {
  8895. $aliasOfCandidate = $candidate->getAliasOf();
  8896. }
  8897. if ($this->whitelist !== null && !$bypassFilters && (
  8898. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8899. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8900. )) {
  8901. continue;
  8902. }
  8903. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8904. case self::MATCH_NONE:
  8905. break;
  8906. case self::MATCH_NAME:
  8907. $nameMatch = true;
  8908. break;
  8909. case self::MATCH:
  8910. $nameMatch = true;
  8911. $matches[] = $candidate;
  8912. break;
  8913. case self::MATCH_PROVIDE:
  8914. $provideMatches[] = $candidate;
  8915. break;
  8916. case self::MATCH_REPLACE:
  8917. $matches[] = $candidate;
  8918. break;
  8919. case self::MATCH_FILTERED:
  8920. break;
  8921. default:
  8922. throw new \UnexpectedValueException('Unexpected match type');
  8923. }
  8924. }
  8925. if ($nameMatch) {
  8926. return $matches;
  8927. }
  8928. return array_merge($matches, $provideMatches);
  8929. }
  8930. public function literalToPackage($literal)
  8931. {
  8932. $packageId = abs($literal);
  8933. return $this->packageById($packageId);
  8934. }
  8935. public function literalToPrettyString($literal, $installedMap)
  8936. {
  8937. $package = $this->literalToPackage($literal);
  8938. if (isset($installedMap[$package->id])) {
  8939. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8940. } else {
  8941. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8942. }
  8943. return $prefix.' '.$package->getPrettyString();
  8944. }
  8945. public function isPackageAcceptable($name, $stability)
  8946. {
  8947. foreach ((array) $name as $n) {
  8948. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8949. return true;
  8950. }
  8951. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8952. return true;
  8953. }
  8954. }
  8955. return false;
  8956. }
  8957. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8958. {
  8959. $candidateName = $candidate->getName();
  8960. $candidateVersion = $candidate->getVersion();
  8961. $isDev = $candidate->getStability() === 'dev';
  8962. $isAlias = $candidate instanceof AliasPackage;
  8963. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8964. $requireFilter = $this->filterRequires[$name];
  8965. } else {
  8966. $requireFilter = new EmptyConstraint;
  8967. }
  8968. if ($candidateName === $name) {
  8969. $pkgConstraint = new Constraint('==', $candidateVersion);
  8970. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8971. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8972. }
  8973. return self::MATCH_NAME;
  8974. }
  8975. $provides = $candidate->getProvides();
  8976. $replaces = $candidate->getReplaces();
  8977. if (isset($replaces[0]) || isset($provides[0])) {
  8978. foreach ($provides as $link) {
  8979. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8980. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8981. }
  8982. }
  8983. foreach ($replaces as $link) {
  8984. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8985. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8986. }
  8987. }
  8988. return self::MATCH_NONE;
  8989. }
  8990. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8991. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8992. }
  8993. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8994. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8995. }
  8996. return self::MATCH_NONE;
  8997. }
  8998. }
  8999. <?php
  9000. namespace Composer\DependencyResolver;
  9001. use Composer\Package\CompletePackageInterface;
  9002. class Problem
  9003. {
  9004. protected $reasonSeen;
  9005. protected $reasons = array();
  9006. protected $section = 0;
  9007. protected $pool;
  9008. public function __construct(Pool $pool)
  9009. {
  9010. $this->pool = $pool;
  9011. }
  9012. public function addRule(Rule $rule)
  9013. {
  9014. $this->addReason(spl_object_hash($rule), array(
  9015. 'rule' => $rule,
  9016. 'job' => $rule->getJob(),
  9017. ));
  9018. }
  9019. public function getReasons()
  9020. {
  9021. return $this->reasons;
  9022. }
  9023. public function getPrettyString(array $installedMap = array())
  9024. {
  9025. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  9026. if (count($reasons) === 1) {
  9027. reset($reasons);
  9028. $reason = current($reasons);
  9029. $job = $reason['job'];
  9030. $packageName = $job['packageName'];
  9031. $constraint = $job['constraint'];
  9032. if (isset($constraint)) {
  9033. $packages = $this->pool->whatProvides($packageName, $constraint);
  9034. } else {
  9035. $packages = array();
  9036. }
  9037. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  9038. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  9039. $version = phpversion();
  9040. $available = $this->pool->whatProvides($packageName);
  9041. if (count($available)) {
  9042. $firstAvailable = reset($available);
  9043. $version = $firstAvailable->getPrettyVersion();
  9044. $extra = $firstAvailable->getExtra();
  9045. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  9046. $version .= '; ' . $firstAvailable->getDescription();
  9047. }
  9048. }
  9049. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  9050. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  9051. return $msg . 'your HHVM version does not satisfy that requirement.';
  9052. }
  9053. if ($packageName === 'hhvm') {
  9054. return $msg . 'you are running this with PHP and not HHVM.';
  9055. }
  9056. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  9057. }
  9058. if (0 === stripos($packageName, 'ext-')) {
  9059. if (false !== strpos($packageName, ' ')) {
  9060. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  9061. }
  9062. $ext = substr($packageName, 4);
  9063. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9064. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  9065. }
  9066. if (0 === stripos($packageName, 'lib-')) {
  9067. if (strtolower($packageName) === 'lib-icu') {
  9068. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  9069. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  9070. }
  9071. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  9072. }
  9073. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  9074. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  9075. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  9076. }
  9077. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  9078. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  9079. }
  9080. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  9081. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  9082. }
  9083. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  9084. }
  9085. }
  9086. $messages = array();
  9087. foreach ($reasons as $reason) {
  9088. $rule = $reason['rule'];
  9089. $job = $reason['job'];
  9090. if ($job) {
  9091. $messages[] = $this->jobToText($job);
  9092. } elseif ($rule) {
  9093. if ($rule instanceof Rule) {
  9094. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  9095. }
  9096. }
  9097. }
  9098. return "\n - ".implode("\n - ", $messages);
  9099. }
  9100. protected function addReason($id, $reason)
  9101. {
  9102. if (!isset($this->reasonSeen[$id])) {
  9103. $this->reasonSeen[$id] = true;
  9104. $this->reasons[$this->section][] = $reason;
  9105. }
  9106. }
  9107. public function nextSection()
  9108. {
  9109. $this->section++;
  9110. }
  9111. protected function jobToText($job)
  9112. {
  9113. $packageName = $job['packageName'];
  9114. $constraint = $job['constraint'];
  9115. switch ($job['cmd']) {
  9116. case 'install':
  9117. $packages = $this->pool->whatProvides($packageName, $constraint);
  9118. if (!$packages) {
  9119. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  9120. }
  9121. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  9122. case 'update':
  9123. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  9124. case 'remove':
  9125. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  9126. }
  9127. if (isset($constraint)) {
  9128. $packages = $this->pool->whatProvides($packageName, $constraint);
  9129. } else {
  9130. $packages = array();
  9131. }
  9132. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  9133. }
  9134. protected function getPackageList($packages)
  9135. {
  9136. $prepared = array();
  9137. foreach ($packages as $package) {
  9138. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9139. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9140. }
  9141. foreach ($prepared as $name => $package) {
  9142. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9143. }
  9144. return implode(', ', $prepared);
  9145. }
  9146. protected function constraintToText($constraint)
  9147. {
  9148. return $constraint ? ' '.$constraint->getPrettyString() : '';
  9149. }
  9150. }
  9151. <?php
  9152. namespace Composer\DependencyResolver;
  9153. use Composer\Semver\Constraint\ConstraintInterface;
  9154. class Request
  9155. {
  9156. protected $jobs;
  9157. public function __construct()
  9158. {
  9159. $this->jobs = array();
  9160. }
  9161. public function install($packageName, ConstraintInterface $constraint = null)
  9162. {
  9163. $this->addJob($packageName, 'install', $constraint);
  9164. }
  9165. public function update($packageName, ConstraintInterface $constraint = null)
  9166. {
  9167. $this->addJob($packageName, 'update', $constraint);
  9168. }
  9169. public function remove($packageName, ConstraintInterface $constraint = null)
  9170. {
  9171. $this->addJob($packageName, 'remove', $constraint);
  9172. }
  9173. public function fix($packageName, ConstraintInterface $constraint = null)
  9174. {
  9175. $this->addJob($packageName, 'install', $constraint, true);
  9176. }
  9177. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  9178. {
  9179. $packageName = strtolower($packageName);
  9180. $this->jobs[] = array(
  9181. 'cmd' => $cmd,
  9182. 'packageName' => $packageName,
  9183. 'constraint' => $constraint,
  9184. 'fixed' => $fixed,
  9185. );
  9186. }
  9187. public function updateAll()
  9188. {
  9189. $this->jobs[] = array('cmd' => 'update-all');
  9190. }
  9191. public function getJobs()
  9192. {
  9193. return $this->jobs;
  9194. }
  9195. }
  9196. <?php
  9197. namespace Composer\DependencyResolver;
  9198. use Composer\Package\CompletePackage;
  9199. use Composer\Package\Link;
  9200. use Composer\Package\PackageInterface;
  9201. abstract class Rule
  9202. {
  9203. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  9204. const RULE_JOB_INSTALL = 2;
  9205. const RULE_JOB_REMOVE = 3;
  9206. const RULE_PACKAGE_CONFLICT = 6;
  9207. const RULE_PACKAGE_REQUIRES = 7;
  9208. const RULE_PACKAGE_OBSOLETES = 8;
  9209. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  9210. const RULE_PACKAGE_SAME_NAME = 10;
  9211. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  9212. const RULE_LEARNED = 12;
  9213. const RULE_PACKAGE_ALIAS = 13;
  9214. const BITFIELD_TYPE = 0;
  9215. const BITFIELD_REASON = 8;
  9216. const BITFIELD_DISABLED = 16;
  9217. protected $bitfield;
  9218. protected $job;
  9219. protected $reasonData;
  9220. public function __construct($reason, $reasonData, $job = null)
  9221. {
  9222. $this->reasonData = $reasonData;
  9223. if ($job) {
  9224. $this->job = $job;
  9225. }
  9226. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  9227. ($reason << self::BITFIELD_REASON) |
  9228. (255 << self::BITFIELD_TYPE);
  9229. }
  9230. abstract public function getLiterals();
  9231. abstract public function getHash();
  9232. public function getJob()
  9233. {
  9234. return $this->job;
  9235. }
  9236. abstract public function equals(Rule $rule);
  9237. public function getReason()
  9238. {
  9239. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  9240. }
  9241. public function getReasonData()
  9242. {
  9243. return $this->reasonData;
  9244. }
  9245. public function getRequiredPackage()
  9246. {
  9247. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  9248. return $this->reasonData;
  9249. }
  9250. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  9251. return $this->reasonData->getTarget();
  9252. }
  9253. }
  9254. public function setType($type)
  9255. {
  9256. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  9257. }
  9258. public function getType()
  9259. {
  9260. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  9261. }
  9262. public function disable()
  9263. {
  9264. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  9265. }
  9266. public function enable()
  9267. {
  9268. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  9269. }
  9270. public function isDisabled()
  9271. {
  9272. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9273. }
  9274. public function isEnabled()
  9275. {
  9276. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9277. }
  9278. abstract public function isAssertion();
  9279. public function getPrettyString(Pool $pool, array $installedMap = array())
  9280. {
  9281. $literals = $this->getLiterals();
  9282. $ruleText = '';
  9283. foreach ($literals as $i => $literal) {
  9284. if ($i != 0) {
  9285. $ruleText .= '|';
  9286. }
  9287. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  9288. }
  9289. switch ($this->getReason()) {
  9290. case self::RULE_INTERNAL_ALLOW_UPDATE:
  9291. return $ruleText;
  9292. case self::RULE_JOB_INSTALL:
  9293. return "Install command rule ($ruleText)";
  9294. case self::RULE_JOB_REMOVE:
  9295. return "Remove command rule ($ruleText)";
  9296. case self::RULE_PACKAGE_CONFLICT:
  9297. $package1 = $pool->literalToPackage($literals[0]);
  9298. $package2 = $pool->literalToPackage($literals[1]);
  9299. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  9300. case self::RULE_PACKAGE_REQUIRES:
  9301. $sourceLiteral = array_shift($literals);
  9302. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  9303. $requires = array();
  9304. foreach ($literals as $literal) {
  9305. $requires[] = $pool->literalToPackage($literal);
  9306. }
  9307. $text = $this->reasonData->getPrettyString($sourcePackage);
  9308. if ($requires) {
  9309. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  9310. } else {
  9311. $targetName = $this->reasonData->getTarget();
  9312. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  9313. if (defined('HHVM_VERSION')) {
  9314. return $text . ' -> your HHVM version does not satisfy that requirement.';
  9315. }
  9316. $packages = $pool->whatProvides($targetName);
  9317. $package = count($packages) ? current($packages) : phpversion();
  9318. if ($targetName === 'hhvm') {
  9319. if ($package instanceof CompletePackage) {
  9320. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9321. } else {
  9322. return $text . ' -> you are running this with PHP and not HHVM.';
  9323. }
  9324. }
  9325. if (!($package instanceof CompletePackage)) {
  9326. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  9327. }
  9328. $extra = $package->getExtra();
  9329. if (!empty($extra['config.platform'])) {
  9330. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9331. } else {
  9332. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9333. }
  9334. return $text;
  9335. }
  9336. if (0 === strpos($targetName, 'ext-')) {
  9337. $ext = substr($targetName, 4);
  9338. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9339. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  9340. }
  9341. if (0 === strpos($targetName, 'lib-')) {
  9342. $lib = substr($targetName, 4);
  9343. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  9344. }
  9345. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  9346. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  9347. }
  9348. return $text . ' -> no matching package found.';
  9349. }
  9350. return $text;
  9351. case self::RULE_PACKAGE_OBSOLETES:
  9352. return $ruleText;
  9353. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  9354. return $ruleText;
  9355. case self::RULE_PACKAGE_SAME_NAME:
  9356. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  9357. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  9358. return $ruleText;
  9359. case self::RULE_LEARNED:
  9360. return 'Conclusion: '.$ruleText;
  9361. case self::RULE_PACKAGE_ALIAS:
  9362. return $ruleText;
  9363. default:
  9364. return '('.$ruleText.')';
  9365. }
  9366. }
  9367. protected function formatPackagesUnique($pool, array $packages)
  9368. {
  9369. $prepared = array();
  9370. foreach ($packages as $package) {
  9371. if (!is_object($package)) {
  9372. $package = $pool->literalToPackage($package);
  9373. }
  9374. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9375. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9376. }
  9377. foreach ($prepared as $name => $package) {
  9378. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9379. }
  9380. return implode(', ', $prepared);
  9381. }
  9382. }
  9383. <?php
  9384. namespace Composer\DependencyResolver;
  9385. use Composer\Package\PackageInterface;
  9386. use Composer\Package\Link;
  9387. class Rule2Literals extends Rule
  9388. {
  9389. protected $literal1;
  9390. protected $literal2;
  9391. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  9392. {
  9393. parent::__construct($reason, $reasonData, $job);
  9394. if ($literal1 < $literal2) {
  9395. $this->literal1 = $literal1;
  9396. $this->literal2 = $literal2;
  9397. } else {
  9398. $this->literal1 = $literal2;
  9399. $this->literal2 = $literal1;
  9400. }
  9401. }
  9402. public function getLiterals()
  9403. {
  9404. return array($this->literal1, $this->literal2);
  9405. }
  9406. public function getHash()
  9407. {
  9408. return $this->literal1.','.$this->literal2;
  9409. }
  9410. public function equals(Rule $rule)
  9411. {
  9412. if ($rule instanceof self) {
  9413. if ($this->literal1 !== $rule->literal1) {
  9414. return false;
  9415. }
  9416. if ($this->literal2 !== $rule->literal2) {
  9417. return false;
  9418. }
  9419. return true;
  9420. }
  9421. $literals = $rule->getLiterals();
  9422. if (2 != count($literals)) {
  9423. return false;
  9424. }
  9425. if ($this->literal1 !== $literals[0]) {
  9426. return false;
  9427. }
  9428. if ($this->literal2 !== $literals[1]) {
  9429. return false;
  9430. }
  9431. return true;
  9432. }
  9433. public function isAssertion()
  9434. {
  9435. return false;
  9436. }
  9437. public function __toString()
  9438. {
  9439. $result = $this->isDisabled() ? 'disabled(' : '(';
  9440. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  9441. return $result;
  9442. }
  9443. }
  9444. <?php
  9445. namespace Composer\DependencyResolver;
  9446. class RuleSet implements \IteratorAggregate, \Countable
  9447. {
  9448. const TYPE_PACKAGE = 0;
  9449. const TYPE_JOB = 1;
  9450. const TYPE_LEARNED = 4;
  9451. public $ruleById;
  9452. protected static $types = array(
  9453. 255 => 'UNKNOWN',
  9454. self::TYPE_PACKAGE => 'PACKAGE',
  9455. self::TYPE_JOB => 'JOB',
  9456. self::TYPE_LEARNED => 'LEARNED',
  9457. );
  9458. protected $rules;
  9459. protected $nextRuleId;
  9460. protected $rulesByHash;
  9461. public function __construct()
  9462. {
  9463. $this->nextRuleId = 0;
  9464. foreach ($this->getTypes() as $type) {
  9465. $this->rules[$type] = array();
  9466. }
  9467. $this->rulesByHash = array();
  9468. }
  9469. public function add(Rule $rule, $type)
  9470. {
  9471. if (!isset(self::$types[$type])) {
  9472. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  9473. }
  9474. $hash = $rule->getHash();
  9475. if (isset($this->rulesByHash[$hash])) {
  9476. $potentialDuplicates = $this->rulesByHash[$hash];
  9477. if (is_array($potentialDuplicates)) {
  9478. foreach ($potentialDuplicates as $potentialDuplicate) {
  9479. if ($rule->equals($potentialDuplicate)) {
  9480. return;
  9481. }
  9482. }
  9483. } else {
  9484. if ($rule->equals($potentialDuplicates)) {
  9485. return;
  9486. }
  9487. }
  9488. }
  9489. if (!isset($this->rules[$type])) {
  9490. $this->rules[$type] = array();
  9491. }
  9492. $this->rules[$type][] = $rule;
  9493. $this->ruleById[$this->nextRuleId] = $rule;
  9494. $rule->setType($type);
  9495. $this->nextRuleId++;
  9496. if (!isset($this->rulesByHash[$hash])) {
  9497. $this->rulesByHash[$hash] = $rule;
  9498. } elseif (is_array($this->rulesByHash[$hash])) {
  9499. $this->rulesByHash[$hash][] = $rule;
  9500. } else {
  9501. $originalRule = $this->rulesByHash[$hash];
  9502. $this->rulesByHash[$hash] = array($originalRule, $rule);
  9503. }
  9504. }
  9505. public function count()
  9506. {
  9507. return $this->nextRuleId;
  9508. }
  9509. public function ruleById($id)
  9510. {
  9511. return $this->ruleById[$id];
  9512. }
  9513. public function getRules()
  9514. {
  9515. return $this->rules;
  9516. }
  9517. public function getIterator()
  9518. {
  9519. return new RuleSetIterator($this->getRules());
  9520. }
  9521. public function getIteratorFor($types)
  9522. {
  9523. if (!is_array($types)) {
  9524. $types = array($types);
  9525. }
  9526. $allRules = $this->getRules();
  9527. $rules = array();
  9528. foreach ($types as $type) {
  9529. $rules[$type] = $allRules[$type];
  9530. }
  9531. return new RuleSetIterator($rules);
  9532. }
  9533. public function getIteratorWithout($types)
  9534. {
  9535. if (!is_array($types)) {
  9536. $types = array($types);
  9537. }
  9538. $rules = $this->getRules();
  9539. foreach ($types as $type) {
  9540. unset($rules[$type]);
  9541. }
  9542. return new RuleSetIterator($rules);
  9543. }
  9544. public function getTypes()
  9545. {
  9546. $types = self::$types;
  9547. unset($types[255]);
  9548. return array_keys($types);
  9549. }
  9550. public function getPrettyString(Pool $pool = null)
  9551. {
  9552. $string = "\n";
  9553. foreach ($this->rules as $type => $rules) {
  9554. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  9555. foreach ($rules as $rule) {
  9556. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  9557. }
  9558. $string .= "\n\n";
  9559. }
  9560. return $string;
  9561. }
  9562. public function __toString()
  9563. {
  9564. return $this->getPrettyString(null);
  9565. }
  9566. }
  9567. <?php
  9568. namespace Composer\DependencyResolver;
  9569. use Composer\Package\PackageInterface;
  9570. use Composer\Package\AliasPackage;
  9571. use Composer\Repository\PlatformRepository;
  9572. class RuleSetGenerator
  9573. {
  9574. protected $policy;
  9575. protected $pool;
  9576. protected $rules;
  9577. protected $jobs;
  9578. protected $installedMap;
  9579. protected $allowListedMap;
  9580. protected $addedMap;
  9581. protected $conflictAddedMap;
  9582. protected $addedPackages;
  9583. protected $addedPackagesByNames;
  9584. public function __construct(PolicyInterface $policy, Pool $pool)
  9585. {
  9586. $this->policy = $policy;
  9587. $this->pool = $pool;
  9588. }
  9589. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9590. {
  9591. $literals = array(-$package->id);
  9592. foreach ($providers as $provider) {
  9593. if ($provider === $package) {
  9594. return null;
  9595. }
  9596. $literals[] = $provider->id;
  9597. }
  9598. return new GenericRule($literals, $reason, $reasonData);
  9599. }
  9600. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9601. {
  9602. $literals = array();
  9603. foreach ($packages as $package) {
  9604. $literals[] = $package->id;
  9605. }
  9606. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9607. }
  9608. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9609. {
  9610. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9611. }
  9612. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9613. {
  9614. if ($issuer === $provider) {
  9615. return null;
  9616. }
  9617. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9618. }
  9619. private function addRule($type, Rule $newRule = null)
  9620. {
  9621. if (!$newRule) {
  9622. return;
  9623. }
  9624. $this->rules->add($newRule, $type);
  9625. }
  9626. protected function allowListFromPackage(PackageInterface $package)
  9627. {
  9628. $this->whitelistFromPackage($package);
  9629. }
  9630. protected function whitelistFromPackage(PackageInterface $package)
  9631. {
  9632. $workQueue = new \SplQueue;
  9633. $workQueue->enqueue($package);
  9634. while (!$workQueue->isEmpty()) {
  9635. $package = $workQueue->dequeue();
  9636. if (isset($this->allowListedMap[$package->id])) {
  9637. continue;
  9638. }
  9639. $this->allowListedMap[$package->id] = true;
  9640. foreach ($package->getRequires() as $link) {
  9641. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9642. foreach ($possibleRequires as $require) {
  9643. $workQueue->enqueue($require);
  9644. }
  9645. }
  9646. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9647. foreach ($obsoleteProviders as $provider) {
  9648. if ($provider === $package) {
  9649. continue;
  9650. }
  9651. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9652. $workQueue->enqueue($provider);
  9653. }
  9654. }
  9655. }
  9656. }
  9657. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9658. {
  9659. $workQueue = new \SplQueue;
  9660. $workQueue->enqueue($package);
  9661. while (!$workQueue->isEmpty()) {
  9662. $package = $workQueue->dequeue();
  9663. if (isset($this->addedMap[$package->id])) {
  9664. continue;
  9665. }
  9666. $this->addedMap[$package->id] = true;
  9667. $this->addedPackages[] = $package;
  9668. foreach ($package->getNames() as $name) {
  9669. $this->addedPackagesByNames[$name][] = $package;
  9670. }
  9671. foreach ($package->getRequires() as $link) {
  9672. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9673. continue;
  9674. }
  9675. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9676. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9677. foreach ($possibleRequires as $require) {
  9678. $workQueue->enqueue($require);
  9679. }
  9680. }
  9681. $packageName = $package->getName();
  9682. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9683. foreach ($obsoleteProviders as $provider) {
  9684. if ($provider === $package) {
  9685. continue;
  9686. }
  9687. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9688. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9689. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9690. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9691. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9692. }
  9693. }
  9694. }
  9695. }
  9696. protected function addConflictRules($ignorePlatformReqs = false)
  9697. {
  9698. foreach ($this->addedPackages as $package) {
  9699. foreach ($package->getConflicts() as $link) {
  9700. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9701. continue;
  9702. }
  9703. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9704. continue;
  9705. }
  9706. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9707. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9708. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9709. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9710. }
  9711. }
  9712. }
  9713. $isInstalled = isset($this->installedMap[$package->id]);
  9714. foreach ($package->getReplaces() as $link) {
  9715. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9716. continue;
  9717. }
  9718. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9719. if ($provider === $package) {
  9720. continue;
  9721. }
  9722. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9723. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9724. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9725. }
  9726. }
  9727. }
  9728. }
  9729. }
  9730. protected function obsoleteImpossibleForAlias($package, $provider)
  9731. {
  9732. $packageIsAlias = $package instanceof AliasPackage;
  9733. $providerIsAlias = $provider instanceof AliasPackage;
  9734. $impossible = (
  9735. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9736. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9737. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9738. );
  9739. return $impossible;
  9740. }
  9741. protected function allowListFromJobs()
  9742. {
  9743. $this->whitelistFromJobs();
  9744. }
  9745. protected function whitelistFromJobs()
  9746. {
  9747. foreach ($this->jobs as $job) {
  9748. switch ($job['cmd']) {
  9749. case 'install':
  9750. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9751. foreach ($packages as $package) {
  9752. $this->allowListFromPackage($package);
  9753. }
  9754. break;
  9755. }
  9756. }
  9757. }
  9758. protected function addRulesForJobs($ignorePlatformReqs)
  9759. {
  9760. foreach ($this->jobs as $job) {
  9761. switch ($job['cmd']) {
  9762. case 'install':
  9763. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9764. break;
  9765. }
  9766. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9767. if ($packages) {
  9768. foreach ($packages as $package) {
  9769. if (!isset($this->installedMap[$package->id])) {
  9770. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9771. }
  9772. }
  9773. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9774. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9775. }
  9776. break;
  9777. case 'remove':
  9778. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9779. foreach ($packages as $package) {
  9780. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9781. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9782. }
  9783. break;
  9784. }
  9785. }
  9786. }
  9787. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9788. {
  9789. $this->jobs = $jobs;
  9790. $this->rules = new RuleSet;
  9791. $this->installedMap = $installedMap;
  9792. $this->allowListedMap = array();
  9793. foreach ($this->installedMap as $package) {
  9794. $this->allowListFromPackage($package);
  9795. }
  9796. $this->allowListFromJobs();
  9797. $this->pool->setAllowList($this->allowListedMap);
  9798. $this->addedMap = array();
  9799. $this->conflictAddedMap = array();
  9800. $this->addedPackages = array();
  9801. $this->addedPackagesByNames = array();
  9802. foreach ($this->installedMap as $package) {
  9803. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9804. }
  9805. $this->addRulesForJobs($ignorePlatformReqs);
  9806. $this->addConflictRules($ignorePlatformReqs);
  9807. $this->addedPackages = $this->addedPackagesByNames = null;
  9808. return $this->rules;
  9809. }
  9810. }
  9811. <?php
  9812. namespace Composer\DependencyResolver;
  9813. class RuleSetIterator implements \Iterator
  9814. {
  9815. protected $rules;
  9816. protected $types;
  9817. protected $currentOffset;
  9818. protected $currentType;
  9819. protected $currentTypeOffset;
  9820. public function __construct(array $rules)
  9821. {
  9822. $this->rules = $rules;
  9823. $this->types = array_keys($rules);
  9824. sort($this->types);
  9825. $this->rewind();
  9826. }
  9827. public function current()
  9828. {
  9829. return $this->rules[$this->currentType][$this->currentOffset];
  9830. }
  9831. public function key()
  9832. {
  9833. return $this->currentType;
  9834. }
  9835. public function next()
  9836. {
  9837. $this->currentOffset++;
  9838. if (!isset($this->rules[$this->currentType])) {
  9839. return;
  9840. }
  9841. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9842. $this->currentOffset = 0;
  9843. do {
  9844. $this->currentTypeOffset++;
  9845. if (!isset($this->types[$this->currentTypeOffset])) {
  9846. $this->currentType = -1;
  9847. break;
  9848. }
  9849. $this->currentType = $this->types[$this->currentTypeOffset];
  9850. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9851. }
  9852. }
  9853. public function rewind()
  9854. {
  9855. $this->currentOffset = 0;
  9856. $this->currentTypeOffset = -1;
  9857. $this->currentType = -1;
  9858. do {
  9859. $this->currentTypeOffset++;
  9860. if (!isset($this->types[$this->currentTypeOffset])) {
  9861. $this->currentType = -1;
  9862. break;
  9863. }
  9864. $this->currentType = $this->types[$this->currentTypeOffset];
  9865. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9866. }
  9867. public function valid()
  9868. {
  9869. return isset($this->rules[$this->currentType])
  9870. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9871. }
  9872. }
  9873. <?php
  9874. namespace Composer\DependencyResolver;
  9875. class RuleWatchChain extends \SplDoublyLinkedList
  9876. {
  9877. protected $offset = 0;
  9878. public function seek($offset)
  9879. {
  9880. $this->rewind();
  9881. for ($i = 0; $i < $offset; $i++, $this->next());
  9882. }
  9883. public function remove()
  9884. {
  9885. $offset = $this->key();
  9886. $this->offsetUnset($offset);
  9887. $this->seek($offset);
  9888. }
  9889. }
  9890. <?php
  9891. namespace Composer\DependencyResolver;
  9892. class RuleWatchGraph
  9893. {
  9894. protected $watchChains = array();
  9895. public function insert(RuleWatchNode $node)
  9896. {
  9897. if ($node->getRule()->isAssertion()) {
  9898. return;
  9899. }
  9900. foreach (array($node->watch1, $node->watch2) as $literal) {
  9901. if (!isset($this->watchChains[$literal])) {
  9902. $this->watchChains[$literal] = new RuleWatchChain;
  9903. }
  9904. $this->watchChains[$literal]->unshift($node);
  9905. }
  9906. }
  9907. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9908. {
  9909. $literal = -$decidedLiteral;
  9910. if (!isset($this->watchChains[$literal])) {
  9911. return null;
  9912. }
  9913. $chain = $this->watchChains[$literal];
  9914. $chain->rewind();
  9915. while ($chain->valid()) {
  9916. $node = $chain->current();
  9917. $otherWatch = $node->getOtherWatch($literal);
  9918. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9919. $ruleLiterals = $node->getRule()->getLiterals();
  9920. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9921. return $literal !== $ruleLiteral &&
  9922. $otherWatch !== $ruleLiteral &&
  9923. !$decisions->conflict($ruleLiteral);
  9924. });
  9925. if ($alternativeLiterals) {
  9926. reset($alternativeLiterals);
  9927. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9928. continue;
  9929. }
  9930. if ($decisions->conflict($otherWatch)) {
  9931. return $node->getRule();
  9932. }
  9933. $decisions->decide($otherWatch, $level, $node->getRule());
  9934. }
  9935. $chain->next();
  9936. }
  9937. return null;
  9938. }
  9939. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9940. {
  9941. if (!isset($this->watchChains[$toLiteral])) {
  9942. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9943. }
  9944. $node->moveWatch($fromLiteral, $toLiteral);
  9945. $this->watchChains[$fromLiteral]->remove();
  9946. $this->watchChains[$toLiteral]->unshift($node);
  9947. }
  9948. }
  9949. <?php
  9950. namespace Composer\DependencyResolver;
  9951. class RuleWatchNode
  9952. {
  9953. public $watch1;
  9954. public $watch2;
  9955. protected $rule;
  9956. public function __construct($rule)
  9957. {
  9958. $this->rule = $rule;
  9959. $literals = $rule->getLiterals();
  9960. $literalCount = count($literals);
  9961. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9962. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9963. }
  9964. public function watch2OnHighest(Decisions $decisions)
  9965. {
  9966. $literals = $this->rule->getLiterals();
  9967. if (count($literals) < 3) {
  9968. return;
  9969. }
  9970. $watchLevel = 0;
  9971. foreach ($literals as $literal) {
  9972. $level = $decisions->decisionLevel($literal);
  9973. if ($level > $watchLevel) {
  9974. $this->watch2 = $literal;
  9975. $watchLevel = $level;
  9976. }
  9977. }
  9978. }
  9979. public function getRule()
  9980. {
  9981. return $this->rule;
  9982. }
  9983. public function getOtherWatch($literal)
  9984. {
  9985. if ($this->watch1 == $literal) {
  9986. return $this->watch2;
  9987. }
  9988. return $this->watch1;
  9989. }
  9990. public function moveWatch($from, $to)
  9991. {
  9992. if ($this->watch1 == $from) {
  9993. $this->watch1 = $to;
  9994. } else {
  9995. $this->watch2 = $to;
  9996. }
  9997. }
  9998. }
  9999. <?php
  10000. namespace Composer\DependencyResolver;
  10001. use Composer\IO\IOInterface;
  10002. use Composer\Repository\RepositoryInterface;
  10003. use Composer\Repository\PlatformRepository;
  10004. class Solver
  10005. {
  10006. const BRANCH_LITERALS = 0;
  10007. const BRANCH_LEVEL = 1;
  10008. protected $policy;
  10009. protected $pool;
  10010. protected $installed;
  10011. protected $rules;
  10012. protected $ruleSetGenerator;
  10013. protected $jobs;
  10014. protected $updateMap = array();
  10015. protected $watchGraph;
  10016. protected $decisions;
  10017. protected $installedMap;
  10018. protected $propagateIndex;
  10019. protected $branches = array();
  10020. protected $problems = array();
  10021. protected $learnedPool = array();
  10022. protected $learnedWhy = array();
  10023. public $testFlagLearnedPositiveLiteral = false;
  10024. protected $io;
  10025. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  10026. {
  10027. $this->io = $io;
  10028. $this->policy = $policy;
  10029. $this->pool = $pool;
  10030. $this->installed = $installed;
  10031. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  10032. }
  10033. public function getRuleSetSize()
  10034. {
  10035. return count($this->rules);
  10036. }
  10037. private function makeAssertionRuleDecisions()
  10038. {
  10039. $decisionStart = count($this->decisions) - 1;
  10040. $rulesCount = count($this->rules);
  10041. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  10042. $rule = $this->rules->ruleById[$ruleIndex];
  10043. if (!$rule->isAssertion() || $rule->isDisabled()) {
  10044. continue;
  10045. }
  10046. $literals = $rule->getLiterals();
  10047. $literal = $literals[0];
  10048. if (!$this->decisions->decided($literal)) {
  10049. $this->decisions->decide($literal, 1, $rule);
  10050. continue;
  10051. }
  10052. if ($this->decisions->satisfy($literal)) {
  10053. continue;
  10054. }
  10055. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  10056. $rule->disable();
  10057. continue;
  10058. }
  10059. $conflict = $this->decisions->decisionRule($literal);
  10060. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  10061. $problem = new Problem($this->pool);
  10062. $problem->addRule($rule);
  10063. $problem->addRule($conflict);
  10064. $this->disableProblem($rule);
  10065. $this->problems[] = $problem;
  10066. continue;
  10067. }
  10068. $problem = new Problem($this->pool);
  10069. $problem->addRule($rule);
  10070. $problem->addRule($conflict);
  10071. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  10072. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  10073. continue;
  10074. }
  10075. $assertRuleLiterals = $assertRule->getLiterals();
  10076. $assertRuleLiteral = $assertRuleLiterals[0];
  10077. if (abs($literal) !== abs($assertRuleLiteral)) {
  10078. continue;
  10079. }
  10080. $problem->addRule($assertRule);
  10081. $this->disableProblem($assertRule);
  10082. }
  10083. $this->problems[] = $problem;
  10084. $this->decisions->resetToOffset($decisionStart);
  10085. $ruleIndex = -1;
  10086. }
  10087. }
  10088. protected function setupInstalledMap()
  10089. {
  10090. $this->installedMap = array();
  10091. foreach ($this->installed->getPackages() as $package) {
  10092. $this->installedMap[$package->id] = $package;
  10093. }
  10094. }
  10095. protected function checkForRootRequireProblems($ignorePlatformReqs)
  10096. {
  10097. foreach ($this->jobs as $job) {
  10098. switch ($job['cmd']) {
  10099. case 'update':
  10100. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  10101. foreach ($packages as $package) {
  10102. if (isset($this->installedMap[$package->id])) {
  10103. $this->updateMap[$package->id] = true;
  10104. }
  10105. }
  10106. break;
  10107. case 'update-all':
  10108. foreach ($this->installedMap as $package) {
  10109. $this->updateMap[$package->id] = true;
  10110. }
  10111. break;
  10112. case 'install':
  10113. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  10114. break;
  10115. }
  10116. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  10117. $problem = new Problem($this->pool);
  10118. $problem->addRule(new GenericRule(array(), null, null, $job));
  10119. $this->problems[] = $problem;
  10120. }
  10121. break;
  10122. }
  10123. }
  10124. }
  10125. public function solve(Request $request, $ignorePlatformReqs = false)
  10126. {
  10127. $this->jobs = $request->getJobs();
  10128. $this->setupInstalledMap();
  10129. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  10130. $this->checkForRootRequireProblems($ignorePlatformReqs);
  10131. $this->decisions = new Decisions($this->pool);
  10132. $this->watchGraph = new RuleWatchGraph;
  10133. foreach ($this->rules as $rule) {
  10134. $this->watchGraph->insert(new RuleWatchNode($rule));
  10135. }
  10136. $this->makeAssertionRuleDecisions();
  10137. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  10138. $before = microtime(true);
  10139. $this->runSat(true);
  10140. $this->io->writeError('', true, IOInterface::DEBUG);
  10141. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  10142. foreach ($this->installedMap as $packageId => $void) {
  10143. if ($this->decisions->undecided($packageId)) {
  10144. $this->decisions->decide(-$packageId, 1, null);
  10145. }
  10146. }
  10147. if ($this->problems) {
  10148. throw new SolverProblemsException($this->problems, $this->installedMap);
  10149. }
  10150. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  10151. return $transaction->getOperations();
  10152. }
  10153. protected function propagate($level)
  10154. {
  10155. while ($this->decisions->validOffset($this->propagateIndex)) {
  10156. $decision = $this->decisions->atOffset($this->propagateIndex);
  10157. $conflict = $this->watchGraph->propagateLiteral(
  10158. $decision[Decisions::DECISION_LITERAL],
  10159. $level,
  10160. $this->decisions
  10161. );
  10162. $this->propagateIndex++;
  10163. if ($conflict) {
  10164. return $conflict;
  10165. }
  10166. }
  10167. return null;
  10168. }
  10169. private function revert($level)
  10170. {
  10171. while (!$this->decisions->isEmpty()) {
  10172. $literal = $this->decisions->lastLiteral();
  10173. if ($this->decisions->undecided($literal)) {
  10174. break;
  10175. }
  10176. $decisionLevel = $this->decisions->decisionLevel($literal);
  10177. if ($decisionLevel <= $level) {
  10178. break;
  10179. }
  10180. $this->decisions->revertLast();
  10181. $this->propagateIndex = count($this->decisions);
  10182. }
  10183. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  10184. array_pop($this->branches);
  10185. }
  10186. }
  10187. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  10188. {
  10189. $level++;
  10190. $this->decisions->decide($literal, $level, $rule);
  10191. while (true) {
  10192. $rule = $this->propagate($level);
  10193. if (!$rule) {
  10194. break;
  10195. }
  10196. if ($level == 1) {
  10197. return $this->analyzeUnsolvable($rule, $disableRules);
  10198. }
  10199. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  10200. if ($newLevel <= 0 || $newLevel >= $level) {
  10201. throw new SolverBugException(
  10202. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  10203. );
  10204. } elseif (!$newRule) {
  10205. throw new SolverBugException(
  10206. "No rule was learned from analyzing $rule at level $level."
  10207. );
  10208. }
  10209. $level = $newLevel;
  10210. $this->revert($level);
  10211. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  10212. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  10213. $ruleNode = new RuleWatchNode($newRule);
  10214. $ruleNode->watch2OnHighest($this->decisions);
  10215. $this->watchGraph->insert($ruleNode);
  10216. $this->decisions->decide($learnLiteral, $level, $newRule);
  10217. }
  10218. return $level;
  10219. }
  10220. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  10221. {
  10222. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  10223. $selectedLiteral = array_shift($literals);
  10224. if (count($literals)) {
  10225. $this->branches[] = array($literals, $level);
  10226. }
  10227. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  10228. }
  10229. protected function analyze($level, Rule $rule)
  10230. {
  10231. $analyzedRule = $rule;
  10232. $ruleLevel = 1;
  10233. $num = 0;
  10234. $l1num = 0;
  10235. $seen = array();
  10236. $learnedLiterals = array(null);
  10237. $decisionId = count($this->decisions);
  10238. $this->learnedPool[] = array();
  10239. while (true) {
  10240. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  10241. foreach ($rule->getLiterals() as $literal) {
  10242. if ($this->decisions->satisfy($literal)) {
  10243. continue;
  10244. }
  10245. if (isset($seen[abs($literal)])) {
  10246. continue;
  10247. }
  10248. $seen[abs($literal)] = true;
  10249. $l = $this->decisions->decisionLevel($literal);
  10250. if (1 === $l) {
  10251. $l1num++;
  10252. } elseif ($level === $l) {
  10253. $num++;
  10254. } else {
  10255. $learnedLiterals[] = $literal;
  10256. if ($l > $ruleLevel) {
  10257. $ruleLevel = $l;
  10258. }
  10259. }
  10260. }
  10261. $l1retry = true;
  10262. while ($l1retry) {
  10263. $l1retry = false;
  10264. if (!$num && !--$l1num) {
  10265. break 2;
  10266. }
  10267. while (true) {
  10268. if ($decisionId <= 0) {
  10269. throw new SolverBugException(
  10270. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  10271. );
  10272. }
  10273. $decisionId--;
  10274. $decision = $this->decisions->atOffset($decisionId);
  10275. $literal = $decision[Decisions::DECISION_LITERAL];
  10276. if (isset($seen[abs($literal)])) {
  10277. break;
  10278. }
  10279. }
  10280. unset($seen[abs($literal)]);
  10281. if ($num && 0 === --$num) {
  10282. if ($literal < 0) {
  10283. $this->testFlagLearnedPositiveLiteral = true;
  10284. }
  10285. $learnedLiterals[0] = -$literal;
  10286. if (!$l1num) {
  10287. break 2;
  10288. }
  10289. foreach ($learnedLiterals as $i => $learnedLiteral) {
  10290. if ($i !== 0) {
  10291. unset($seen[abs($learnedLiteral)]);
  10292. }
  10293. }
  10294. $l1num++;
  10295. $l1retry = true;
  10296. }
  10297. }
  10298. $decision = $this->decisions->atOffset($decisionId);
  10299. $rule = $decision[Decisions::DECISION_REASON];
  10300. }
  10301. $why = count($this->learnedPool) - 1;
  10302. if (!$learnedLiterals[0]) {
  10303. throw new SolverBugException(
  10304. "Did not find a learnable literal in analyzed rule $analyzedRule."
  10305. );
  10306. }
  10307. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  10308. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  10309. }
  10310. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  10311. {
  10312. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  10313. $why = spl_object_hash($conflictRule);
  10314. $learnedWhy = $this->learnedWhy[$why];
  10315. $problemRules = $this->learnedPool[$learnedWhy];
  10316. foreach ($problemRules as $problemRule) {
  10317. $this->analyzeUnsolvableRule($problem, $problemRule);
  10318. }
  10319. return;
  10320. }
  10321. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  10322. return;
  10323. }
  10324. $problem->nextSection();
  10325. $problem->addRule($conflictRule);
  10326. }
  10327. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  10328. {
  10329. $problem = new Problem($this->pool);
  10330. $problem->addRule($conflictRule);
  10331. $this->analyzeUnsolvableRule($problem, $conflictRule);
  10332. $this->problems[] = $problem;
  10333. $seen = array();
  10334. $literals = $conflictRule->getLiterals();
  10335. foreach ($literals as $literal) {
  10336. if ($this->decisions->satisfy($literal)) {
  10337. continue;
  10338. }
  10339. $seen[abs($literal)] = true;
  10340. }
  10341. foreach ($this->decisions as $decision) {
  10342. $literal = $decision[Decisions::DECISION_LITERAL];
  10343. if (!isset($seen[abs($literal)])) {
  10344. continue;
  10345. }
  10346. $why = $decision[Decisions::DECISION_REASON];
  10347. $problem->addRule($why);
  10348. $this->analyzeUnsolvableRule($problem, $why);
  10349. $literals = $why->getLiterals();
  10350. foreach ($literals as $literal) {
  10351. if ($this->decisions->satisfy($literal)) {
  10352. continue;
  10353. }
  10354. $seen[abs($literal)] = true;
  10355. }
  10356. }
  10357. if ($disableRules) {
  10358. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  10359. $this->disableProblem($reason['rule']);
  10360. }
  10361. $this->resetSolver();
  10362. return 1;
  10363. }
  10364. return 0;
  10365. }
  10366. private function disableProblem(Rule $why)
  10367. {
  10368. $job = $why->getJob();
  10369. if (!$job) {
  10370. $why->disable();
  10371. return;
  10372. }
  10373. foreach ($this->rules as $rule) {
  10374. if ($job === $rule->getJob()) {
  10375. $rule->disable();
  10376. }
  10377. }
  10378. }
  10379. private function resetSolver()
  10380. {
  10381. $this->decisions->reset();
  10382. $this->propagateIndex = 0;
  10383. $this->branches = array();
  10384. $this->enableDisableLearnedRules();
  10385. $this->makeAssertionRuleDecisions();
  10386. }
  10387. private function enableDisableLearnedRules()
  10388. {
  10389. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  10390. $why = $this->learnedWhy[spl_object_hash($rule)];
  10391. $problemRules = $this->learnedPool[$why];
  10392. $foundDisabled = false;
  10393. foreach ($problemRules as $problemRule) {
  10394. if ($problemRule->isDisabled()) {
  10395. $foundDisabled = true;
  10396. break;
  10397. }
  10398. }
  10399. if ($foundDisabled && $rule->isEnabled()) {
  10400. $rule->disable();
  10401. } elseif (!$foundDisabled && $rule->isDisabled()) {
  10402. $rule->enable();
  10403. }
  10404. }
  10405. }
  10406. private function runSat($disableRules = true)
  10407. {
  10408. $this->propagateIndex = 0;
  10409. $decisionQueue = array();
  10410. $disableRules = array();
  10411. $level = 1;
  10412. $systemLevel = $level + 1;
  10413. while (true) {
  10414. if (1 === $level) {
  10415. $conflictRule = $this->propagate($level);
  10416. if (null !== $conflictRule) {
  10417. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  10418. continue;
  10419. }
  10420. return;
  10421. }
  10422. }
  10423. if ($level < $systemLevel) {
  10424. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  10425. foreach ($iterator as $rule) {
  10426. if ($rule->isEnabled()) {
  10427. $decisionQueue = array();
  10428. $noneSatisfied = true;
  10429. foreach ($rule->getLiterals() as $literal) {
  10430. if ($this->decisions->satisfy($literal)) {
  10431. $noneSatisfied = false;
  10432. break;
  10433. }
  10434. if ($literal > 0 && $this->decisions->undecided($literal)) {
  10435. $decisionQueue[] = $literal;
  10436. }
  10437. }
  10438. if ($noneSatisfied && count($decisionQueue)) {
  10439. if (count($this->installed) != count($this->updateMap)) {
  10440. $prunedQueue = array();
  10441. foreach ($decisionQueue as $literal) {
  10442. if (isset($this->installedMap[abs($literal)])) {
  10443. $prunedQueue[] = $literal;
  10444. if (isset($this->updateMap[abs($literal)])) {
  10445. $prunedQueue = $decisionQueue;
  10446. break;
  10447. }
  10448. }
  10449. }
  10450. $decisionQueue = $prunedQueue;
  10451. }
  10452. }
  10453. if ($noneSatisfied && count($decisionQueue)) {
  10454. $oLevel = $level;
  10455. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10456. if (0 === $level) {
  10457. return;
  10458. }
  10459. if ($level <= $oLevel) {
  10460. break;
  10461. }
  10462. }
  10463. }
  10464. }
  10465. $systemLevel = $level + 1;
  10466. $iterator->next();
  10467. if ($iterator->valid()) {
  10468. continue;
  10469. }
  10470. }
  10471. if ($level < $systemLevel) {
  10472. $systemLevel = $level;
  10473. }
  10474. $rulesCount = count($this->rules);
  10475. $pass = 1;
  10476. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  10477. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  10478. if ($i == $rulesCount) {
  10479. if (1 === $pass) {
  10480. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  10481. } else {
  10482. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  10483. }
  10484. $i = 0;
  10485. $pass++;
  10486. }
  10487. $rule = $this->rules->ruleById[$i];
  10488. $literals = $rule->getLiterals();
  10489. if ($rule->isDisabled()) {
  10490. continue;
  10491. }
  10492. $decisionQueue = array();
  10493. foreach ($literals as $literal) {
  10494. if ($literal <= 0) {
  10495. if (!$this->decisions->decidedInstall($literal)) {
  10496. continue 2;
  10497. }
  10498. } else {
  10499. if ($this->decisions->decidedInstall($literal)) {
  10500. continue 2;
  10501. }
  10502. if ($this->decisions->undecided($literal)) {
  10503. $decisionQueue[] = $literal;
  10504. }
  10505. }
  10506. }
  10507. if (count($decisionQueue) < 2) {
  10508. continue;
  10509. }
  10510. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10511. if (0 === $level) {
  10512. return;
  10513. }
  10514. $rulesCount = count($this->rules);
  10515. $n = -1;
  10516. }
  10517. if ($level < $systemLevel) {
  10518. continue;
  10519. }
  10520. if (count($this->branches)) {
  10521. $lastLiteral = null;
  10522. $lastLevel = null;
  10523. $lastBranchIndex = 0;
  10524. $lastBranchOffset = 0;
  10525. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  10526. list($literals, $l) = $this->branches[$i];
  10527. foreach ($literals as $offset => $literal) {
  10528. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  10529. $lastLiteral = $literal;
  10530. $lastBranchIndex = $i;
  10531. $lastBranchOffset = $offset;
  10532. $lastLevel = $l;
  10533. }
  10534. }
  10535. }
  10536. if ($lastLiteral) {
  10537. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  10538. $level = $lastLevel;
  10539. $this->revert($level);
  10540. $why = $this->decisions->lastReason();
  10541. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  10542. if ($level == 0) {
  10543. return;
  10544. }
  10545. continue;
  10546. }
  10547. }
  10548. break;
  10549. }
  10550. }
  10551. }
  10552. <?php
  10553. namespace Composer\DependencyResolver;
  10554. class SolverBugException extends \RuntimeException
  10555. {
  10556. public function __construct($message)
  10557. {
  10558. parent::__construct(
  10559. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  10560. "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"
  10561. );
  10562. }
  10563. }
  10564. <?php
  10565. namespace Composer\DependencyResolver;
  10566. use Composer\Util\IniHelper;
  10567. class SolverProblemsException extends \RuntimeException
  10568. {
  10569. protected $problems;
  10570. protected $installedMap;
  10571. public function __construct(array $problems, array $installedMap)
  10572. {
  10573. $this->problems = $problems;
  10574. $this->installedMap = $installedMap;
  10575. parent::__construct($this->createMessage(), 2);
  10576. }
  10577. protected function createMessage()
  10578. {
  10579. $text = "\n";
  10580. $hasExtensionProblems = false;
  10581. foreach ($this->problems as $i => $problem) {
  10582. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10583. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10584. $hasExtensionProblems = true;
  10585. }
  10586. }
  10587. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10588. $text .= "\nPotential 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.";
  10589. }
  10590. if ($hasExtensionProblems) {
  10591. $text .= $this->createExtensionHint();
  10592. }
  10593. return $text;
  10594. }
  10595. public function getProblems()
  10596. {
  10597. return $this->problems;
  10598. }
  10599. private function createExtensionHint()
  10600. {
  10601. $paths = IniHelper::getAll();
  10602. if (count($paths) === 1 && empty($paths[0])) {
  10603. return '';
  10604. }
  10605. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10606. $text .= implode("\n - ", $paths);
  10607. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10608. return $text;
  10609. }
  10610. private function hasExtensionProblems(array $reasonSets)
  10611. {
  10612. foreach ($reasonSets as $reasonSet) {
  10613. foreach ($reasonSet as $reason) {
  10614. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10615. return true;
  10616. }
  10617. }
  10618. }
  10619. return false;
  10620. }
  10621. }
  10622. <?php
  10623. namespace Composer\DependencyResolver;
  10624. use Composer\Package\AliasPackage;
  10625. class Transaction
  10626. {
  10627. protected $policy;
  10628. protected $pool;
  10629. protected $installedMap;
  10630. protected $decisions;
  10631. protected $transaction;
  10632. public function __construct($policy, $pool, $installedMap, $decisions)
  10633. {
  10634. $this->policy = $policy;
  10635. $this->pool = $pool;
  10636. $this->installedMap = $installedMap;
  10637. $this->decisions = $decisions;
  10638. $this->transaction = array();
  10639. }
  10640. public function getOperations()
  10641. {
  10642. $installMeansUpdateMap = $this->findUpdates();
  10643. $updateMap = array();
  10644. $installMap = array();
  10645. $uninstallMap = array();
  10646. foreach ($this->decisions as $i => $decision) {
  10647. $literal = $decision[Decisions::DECISION_LITERAL];
  10648. $reason = $decision[Decisions::DECISION_REASON];
  10649. $package = $this->pool->literalToPackage($literal);
  10650. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10651. continue;
  10652. }
  10653. if ($literal > 0) {
  10654. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10655. $source = $installMeansUpdateMap[abs($literal)];
  10656. $updateMap[$package->id] = array(
  10657. 'package' => $package,
  10658. 'source' => $source,
  10659. 'reason' => $reason,
  10660. );
  10661. unset($installMeansUpdateMap[abs($literal)]);
  10662. $ignoreRemove[$source->id] = true;
  10663. } else {
  10664. $installMap[$package->id] = array(
  10665. 'package' => $package,
  10666. 'reason' => $reason,
  10667. );
  10668. }
  10669. }
  10670. }
  10671. foreach ($this->decisions as $i => $decision) {
  10672. $literal = $decision[Decisions::DECISION_LITERAL];
  10673. $reason = $decision[Decisions::DECISION_REASON];
  10674. $package = $this->pool->literalToPackage($literal);
  10675. if ($literal <= 0 &&
  10676. isset($this->installedMap[$package->id]) &&
  10677. !isset($ignoreRemove[$package->id])) {
  10678. $uninstallMap[$package->id] = array(
  10679. 'package' => $package,
  10680. 'reason' => $reason,
  10681. );
  10682. }
  10683. }
  10684. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10685. return $this->transaction;
  10686. }
  10687. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10688. {
  10689. $queue = array_map(
  10690. function ($operation) {
  10691. return $operation['package'];
  10692. },
  10693. $this->findRootPackages($installMap, $updateMap)
  10694. );
  10695. $visited = array();
  10696. while (!empty($queue)) {
  10697. $package = array_pop($queue);
  10698. $packageId = $package->id;
  10699. if (!isset($visited[$packageId])) {
  10700. $queue[] = $package;
  10701. if ($package instanceof AliasPackage) {
  10702. $queue[] = $package->getAliasOf();
  10703. } else {
  10704. foreach ($package->getRequires() as $link) {
  10705. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10706. foreach ($possibleRequires as $require) {
  10707. $queue[] = $require;
  10708. }
  10709. }
  10710. }
  10711. $visited[$package->id] = true;
  10712. } else {
  10713. if (isset($installMap[$packageId])) {
  10714. $this->install(
  10715. $installMap[$packageId]['package'],
  10716. $installMap[$packageId]['reason']
  10717. );
  10718. unset($installMap[$packageId]);
  10719. }
  10720. if (isset($updateMap[$packageId])) {
  10721. $this->update(
  10722. $updateMap[$packageId]['source'],
  10723. $updateMap[$packageId]['package'],
  10724. $updateMap[$packageId]['reason']
  10725. );
  10726. unset($updateMap[$packageId]);
  10727. }
  10728. }
  10729. }
  10730. foreach ($uninstallMap as $uninstall) {
  10731. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10732. }
  10733. }
  10734. protected function findRootPackages($installMap, $updateMap)
  10735. {
  10736. $packages = $installMap + $updateMap;
  10737. $roots = $packages;
  10738. foreach ($packages as $packageId => $operation) {
  10739. $package = $operation['package'];
  10740. if (!isset($roots[$packageId])) {
  10741. continue;
  10742. }
  10743. foreach ($package->getRequires() as $link) {
  10744. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10745. foreach ($possibleRequires as $require) {
  10746. if ($require !== $package) {
  10747. unset($roots[$require->id]);
  10748. }
  10749. }
  10750. }
  10751. }
  10752. return $roots;
  10753. }
  10754. protected function findUpdates()
  10755. {
  10756. $installMeansUpdateMap = array();
  10757. foreach ($this->decisions as $i => $decision) {
  10758. $literal = $decision[Decisions::DECISION_LITERAL];
  10759. $package = $this->pool->literalToPackage($literal);
  10760. if ($package instanceof AliasPackage) {
  10761. continue;
  10762. }
  10763. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10764. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10765. $literals = array($package->id);
  10766. foreach ($updates as $update) {
  10767. $literals[] = $update->id;
  10768. }
  10769. foreach ($literals as $updateLiteral) {
  10770. if ($updateLiteral !== $literal) {
  10771. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10772. }
  10773. }
  10774. }
  10775. }
  10776. return $installMeansUpdateMap;
  10777. }
  10778. protected function install($package, $reason)
  10779. {
  10780. if ($package instanceof AliasPackage) {
  10781. return $this->markAliasInstalled($package, $reason);
  10782. }
  10783. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10784. }
  10785. protected function update($from, $to, $reason)
  10786. {
  10787. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10788. }
  10789. protected function uninstall($package, $reason)
  10790. {
  10791. if ($package instanceof AliasPackage) {
  10792. return $this->markAliasUninstalled($package, $reason);
  10793. }
  10794. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10795. }
  10796. protected function markAliasInstalled($package, $reason)
  10797. {
  10798. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10799. }
  10800. protected function markAliasUninstalled($package, $reason)
  10801. {
  10802. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10803. }
  10804. }
  10805. <?php
  10806. namespace Composer\Downloader;
  10807. use Composer\Package\PackageInterface;
  10808. use Symfony\Component\Finder\Finder;
  10809. use Composer\IO\IOInterface;
  10810. abstract class ArchiveDownloader extends FileDownloader
  10811. {
  10812. public function download(PackageInterface $package, $path, $output = true)
  10813. {
  10814. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10815. $retries = 3;
  10816. while ($retries--) {
  10817. $fileName = parent::download($package, $path, $output);
  10818. if ($output) {
  10819. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10820. }
  10821. try {
  10822. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10823. try {
  10824. $this->extract($fileName, $temporaryDir);
  10825. } catch (\Exception $e) {
  10826. parent::clearLastCacheWrite($package);
  10827. throw $e;
  10828. }
  10829. $this->filesystem->unlink($fileName);
  10830. $contentDir = $this->getFolderContent($temporaryDir);
  10831. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10832. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10833. }
  10834. foreach ($contentDir as $file) {
  10835. $file = (string) $file;
  10836. $this->filesystem->rename($file, $path . '/' . basename($file));
  10837. }
  10838. $this->filesystem->removeDirectory($temporaryDir);
  10839. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10840. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10841. }
  10842. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10843. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10844. }
  10845. } catch (\Exception $e) {
  10846. $this->filesystem->removeDirectory($path);
  10847. $this->filesystem->removeDirectory($temporaryDir);
  10848. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10849. $this->io->writeError('');
  10850. if ($this->io->isDebug()) {
  10851. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10852. } else {
  10853. $this->io->writeError(' Invalid zip file, retrying...');
  10854. }
  10855. usleep(500000);
  10856. continue;
  10857. }
  10858. throw $e;
  10859. }
  10860. break;
  10861. }
  10862. }
  10863. protected function getFileName(PackageInterface $package, $path)
  10864. {
  10865. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10866. }
  10867. abstract protected function extract($file, $path);
  10868. private function getFolderContent($dir)
  10869. {
  10870. $finder = Finder::create()
  10871. ->ignoreVCS(false)
  10872. ->ignoreDotFiles(false)
  10873. ->notName('.DS_Store')
  10874. ->depth(0)
  10875. ->in($dir);
  10876. return iterator_to_array($finder);
  10877. }
  10878. }
  10879. <?php
  10880. namespace Composer\Downloader;
  10881. use Composer\Package\PackageInterface;
  10882. interface ChangeReportInterface
  10883. {
  10884. public function getLocalChanges(PackageInterface $package, $path);
  10885. }
  10886. <?php
  10887. namespace Composer\Downloader;
  10888. use Composer\Package\PackageInterface;
  10889. use Composer\IO\IOInterface;
  10890. use Composer\Util\Filesystem;
  10891. class DownloadManager
  10892. {
  10893. private $io;
  10894. private $preferDist = false;
  10895. private $preferSource = false;
  10896. private $packagePreferences = array();
  10897. private $filesystem;
  10898. private $downloaders = array();
  10899. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10900. {
  10901. $this->io = $io;
  10902. $this->preferSource = $preferSource;
  10903. $this->filesystem = $filesystem ?: new Filesystem();
  10904. }
  10905. public function setPreferSource($preferSource)
  10906. {
  10907. $this->preferSource = $preferSource;
  10908. return $this;
  10909. }
  10910. public function setPreferDist($preferDist)
  10911. {
  10912. $this->preferDist = $preferDist;
  10913. return $this;
  10914. }
  10915. public function setPreferences(array $preferences)
  10916. {
  10917. $this->packagePreferences = $preferences;
  10918. return $this;
  10919. }
  10920. public function setOutputProgress($outputProgress)
  10921. {
  10922. foreach ($this->downloaders as $downloader) {
  10923. $downloader->setOutputProgress($outputProgress);
  10924. }
  10925. return $this;
  10926. }
  10927. public function setDownloader($type, DownloaderInterface $downloader)
  10928. {
  10929. $type = strtolower($type);
  10930. $this->downloaders[$type] = $downloader;
  10931. return $this;
  10932. }
  10933. public function getDownloader($type)
  10934. {
  10935. $type = strtolower($type);
  10936. if (!isset($this->downloaders[$type])) {
  10937. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10938. }
  10939. return $this->downloaders[$type];
  10940. }
  10941. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10942. {
  10943. $installationSource = $package->getInstallationSource();
  10944. if ('metapackage' === $package->getType()) {
  10945. return;
  10946. }
  10947. if ('dist' === $installationSource) {
  10948. $downloader = $this->getDownloader($package->getDistType());
  10949. } elseif ('source' === $installationSource) {
  10950. $downloader = $this->getDownloader($package->getSourceType());
  10951. } else {
  10952. throw new \InvalidArgumentException(
  10953. 'Package '.$package.' seems not been installed properly'
  10954. );
  10955. }
  10956. if ($installationSource !== $downloader->getInstallationSource()) {
  10957. throw new \LogicException(sprintf(
  10958. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10959. get_class($downloader),
  10960. $downloader->getInstallationSource(),
  10961. $installationSource,
  10962. $package
  10963. ));
  10964. }
  10965. return $downloader;
  10966. }
  10967. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10968. {
  10969. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10970. $sourceType = $package->getSourceType();
  10971. $distType = $package->getDistType();
  10972. $sources = array();
  10973. if ($sourceType) {
  10974. $sources[] = 'source';
  10975. }
  10976. if ($distType) {
  10977. $sources[] = 'dist';
  10978. }
  10979. if (empty($sources)) {
  10980. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10981. }
  10982. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10983. $sources = array_reverse($sources);
  10984. }
  10985. $this->filesystem->ensureDirectoryExists($targetDir);
  10986. foreach ($sources as $i => $source) {
  10987. if (isset($e)) {
  10988. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10989. }
  10990. $package->setInstallationSource($source);
  10991. try {
  10992. $downloader = $this->getDownloaderForInstalledPackage($package);
  10993. if ($downloader) {
  10994. $downloader->download($package, $targetDir);
  10995. }
  10996. break;
  10997. } catch (\RuntimeException $e) {
  10998. if ($i === count($sources) - 1) {
  10999. throw $e;
  11000. }
  11001. $this->io->writeError(
  11002. ' <warning>Failed to download '.
  11003. $package->getPrettyName().
  11004. ' from ' . $source . ': '.
  11005. $e->getMessage().'</warning>'
  11006. );
  11007. }
  11008. }
  11009. }
  11010. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  11011. {
  11012. $downloader = $this->getDownloaderForInstalledPackage($initial);
  11013. if (!$downloader) {
  11014. return;
  11015. }
  11016. $installationSource = $initial->getInstallationSource();
  11017. if ('dist' === $installationSource) {
  11018. $initialType = $initial->getDistType();
  11019. $targetType = $target->getDistType();
  11020. } else {
  11021. $initialType = $initial->getSourceType();
  11022. $targetType = $target->getSourceType();
  11023. }
  11024. if ($target->isDev() && 'dist' === $installationSource) {
  11025. $downloader->remove($initial, $targetDir);
  11026. $this->download($target, $targetDir);
  11027. return;
  11028. }
  11029. if ($initialType === $targetType) {
  11030. $target->setInstallationSource($installationSource);
  11031. try {
  11032. $downloader->update($initial, $target, $targetDir);
  11033. return;
  11034. } catch (\RuntimeException $e) {
  11035. if (!$this->io->isInteractive()) {
  11036. throw $e;
  11037. }
  11038. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  11039. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  11040. throw $e;
  11041. }
  11042. }
  11043. }
  11044. $downloader->remove($initial, $targetDir);
  11045. $this->download($target, $targetDir, 'source' === $installationSource);
  11046. }
  11047. public function remove(PackageInterface $package, $targetDir)
  11048. {
  11049. $downloader = $this->getDownloaderForInstalledPackage($package);
  11050. if ($downloader) {
  11051. $downloader->remove($package, $targetDir);
  11052. }
  11053. }
  11054. protected function resolvePackageInstallPreference(PackageInterface $package)
  11055. {
  11056. foreach ($this->packagePreferences as $pattern => $preference) {
  11057. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  11058. if (preg_match($pattern, $package->getName())) {
  11059. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  11060. return 'dist';
  11061. }
  11062. return 'source';
  11063. }
  11064. }
  11065. return $package->isDev() ? 'source' : 'dist';
  11066. }
  11067. }
  11068. <?php
  11069. namespace Composer\Downloader;
  11070. use Composer\Package\PackageInterface;
  11071. interface DownloaderInterface
  11072. {
  11073. public function getInstallationSource();
  11074. public function download(PackageInterface $package, $path);
  11075. public function update(PackageInterface $initial, PackageInterface $target, $path);
  11076. public function remove(PackageInterface $package, $path);
  11077. public function setOutputProgress($outputProgress);
  11078. }
  11079. <?php
  11080. namespace Composer\Downloader;
  11081. use Composer\Package\PackageInterface;
  11082. interface DvcsDownloaderInterface
  11083. {
  11084. public function getUnpushedChanges(PackageInterface $package, $path);
  11085. }
  11086. <?php
  11087. namespace Composer\Downloader;
  11088. use Composer\Config;
  11089. use Composer\Cache;
  11090. use Composer\Factory;
  11091. use Composer\IO\IOInterface;
  11092. use Composer\IO\NullIO;
  11093. use Composer\Package\Comparer\Comparer;
  11094. use Composer\Package\PackageInterface;
  11095. use Composer\Package\Version\VersionParser;
  11096. use Composer\Plugin\PluginEvents;
  11097. use Composer\Plugin\PreFileDownloadEvent;
  11098. use Composer\EventDispatcher\EventDispatcher;
  11099. use Composer\Util\Filesystem;
  11100. use Composer\Util\RemoteFilesystem;
  11101. use Composer\Util\Url as UrlUtil;
  11102. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  11103. {
  11104. protected $io;
  11105. protected $config;
  11106. protected $rfs;
  11107. protected $filesystem;
  11108. protected $cache;
  11109. protected $outputProgress = true;
  11110. private $lastCacheWrites = array();
  11111. private $eventDispatcher;
  11112. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  11113. {
  11114. $this->io = $io;
  11115. $this->config = $config;
  11116. $this->eventDispatcher = $eventDispatcher;
  11117. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  11118. $this->filesystem = $filesystem ?: new Filesystem();
  11119. $this->cache = $cache;
  11120. if ($this->cache && $this->cache->gcIsNecessary()) {
  11121. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  11122. }
  11123. }
  11124. public function getInstallationSource()
  11125. {
  11126. return 'dist';
  11127. }
  11128. public function download(PackageInterface $package, $path, $output = true)
  11129. {
  11130. if (!$package->getDistUrl()) {
  11131. throw new \InvalidArgumentException('The given package is missing url information');
  11132. }
  11133. if ($output) {
  11134. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11135. }
  11136. $urls = $package->getDistUrls();
  11137. while ($url = array_shift($urls)) {
  11138. try {
  11139. $fileName = $this->doDownload($package, $path, $url);
  11140. break;
  11141. } catch (\Exception $e) {
  11142. if ($this->io->isDebug()) {
  11143. $this->io->writeError('');
  11144. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  11145. } elseif (count($urls)) {
  11146. $this->io->writeError('');
  11147. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  11148. }
  11149. if (!count($urls)) {
  11150. throw $e;
  11151. }
  11152. }
  11153. }
  11154. if ($output) {
  11155. $this->io->writeError('');
  11156. }
  11157. return $fileName;
  11158. }
  11159. protected function doDownload(PackageInterface $package, $path, $url)
  11160. {
  11161. $this->filesystem->emptyDirectory($path);
  11162. $fileName = $this->getFileName($package, $path);
  11163. $processedUrl = $this->processUrl($package, $url);
  11164. $origin = RemoteFilesystem::getOrigin($processedUrl);
  11165. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  11166. if ($this->eventDispatcher) {
  11167. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  11168. }
  11169. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  11170. try {
  11171. $checksum = $package->getDistSha1Checksum();
  11172. $cacheKey = $this->getCacheKey($package, $processedUrl);
  11173. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  11174. $this->io->writeError('Loading from cache', false);
  11175. } else {
  11176. if (!$this->outputProgress) {
  11177. $this->io->writeError('Downloading', false);
  11178. }
  11179. $retries = 3;
  11180. while ($retries--) {
  11181. try {
  11182. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  11183. break;
  11184. } catch (TransportException $e) {
  11185. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  11186. throw $e;
  11187. }
  11188. $this->io->writeError('');
  11189. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  11190. usleep(500000);
  11191. }
  11192. }
  11193. if (!$this->outputProgress) {
  11194. $this->io->writeError(' (<comment>100%</comment>)', false);
  11195. }
  11196. if ($this->cache) {
  11197. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  11198. $this->cache->copyFrom($cacheKey, $fileName);
  11199. }
  11200. }
  11201. if (!file_exists($fileName)) {
  11202. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  11203. .' directory is writable and you have internet connectivity');
  11204. }
  11205. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  11206. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  11207. }
  11208. } catch (\Exception $e) {
  11209. $this->filesystem->removeDirectory($path);
  11210. $this->clearLastCacheWrite($package);
  11211. throw $e;
  11212. }
  11213. return $fileName;
  11214. }
  11215. public function setOutputProgress($outputProgress)
  11216. {
  11217. $this->outputProgress = $outputProgress;
  11218. return $this;
  11219. }
  11220. protected function clearLastCacheWrite(PackageInterface $package)
  11221. {
  11222. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  11223. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  11224. unset($this->lastCacheWrites[$package->getName()]);
  11225. }
  11226. }
  11227. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11228. {
  11229. $name = $target->getName();
  11230. $from = $initial->getFullPrettyVersion();
  11231. $to = $target->getFullPrettyVersion();
  11232. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11233. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11234. $this->remove($initial, $path, false);
  11235. $this->download($target, $path, false);
  11236. $this->io->writeError('');
  11237. }
  11238. public function remove(PackageInterface $package, $path, $output = true)
  11239. {
  11240. if ($output) {
  11241. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11242. }
  11243. if (!$this->filesystem->removeDirectory($path)) {
  11244. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11245. }
  11246. }
  11247. protected function getFileName(PackageInterface $package, $path)
  11248. {
  11249. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11250. }
  11251. protected function processUrl(PackageInterface $package, $url)
  11252. {
  11253. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  11254. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  11255. }
  11256. if ($package->getDistReference()) {
  11257. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  11258. }
  11259. return $url;
  11260. }
  11261. private function getCacheKey(PackageInterface $package, $processedUrl)
  11262. {
  11263. $cacheKey = sha1($processedUrl);
  11264. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  11265. }
  11266. public function getLocalChanges(PackageInterface $package, $targetDir)
  11267. {
  11268. $prevIO = $this->io;
  11269. $prevProgress = $this->outputProgress;
  11270. $this->io = new NullIO;
  11271. $this->io->loadConfiguration($this->config);
  11272. $this->outputProgress = false;
  11273. $e = null;
  11274. try {
  11275. $this->download($package, $targetDir.'_compare', false);
  11276. $comparer = new Comparer();
  11277. $comparer->setSource($targetDir.'_compare');
  11278. $comparer->setUpdate($targetDir);
  11279. $comparer->doCompare();
  11280. $output = $comparer->getChanged(true, true);
  11281. $this->filesystem->removeDirectory($targetDir.'_compare');
  11282. } catch (\Exception $e) {
  11283. }
  11284. $this->io = $prevIO;
  11285. $this->outputProgress = $prevProgress;
  11286. if ($e) {
  11287. throw $e;
  11288. }
  11289. return trim($output);
  11290. }
  11291. }
  11292. <?php
  11293. namespace Composer\Downloader;
  11294. class FilesystemException extends \Exception
  11295. {
  11296. public function __construct($message = '', $code = 0, \Exception $previous = null)
  11297. {
  11298. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  11299. }
  11300. }
  11301. <?php
  11302. namespace Composer\Downloader;
  11303. use Composer\Package\PackageInterface;
  11304. use Composer\Util\ProcessExecutor;
  11305. class FossilDownloader extends VcsDownloader
  11306. {
  11307. public function doDownload(PackageInterface $package, $path, $url)
  11308. {
  11309. $this->config->prohibitUrlByConfig($url, $this->io);
  11310. $url = ProcessExecutor::escape($url);
  11311. $ref = ProcessExecutor::escape($package->getSourceReference());
  11312. $repoFile = $path . '.fossil';
  11313. $this->io->writeError("Cloning ".$package->getSourceReference());
  11314. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  11315. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  11316. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11317. }
  11318. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  11319. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11320. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11321. }
  11322. $command = sprintf('fossil update %s', $ref);
  11323. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11324. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11325. }
  11326. }
  11327. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11328. {
  11329. $this->config->prohibitUrlByConfig($url, $this->io);
  11330. $url = ProcessExecutor::escape($url);
  11331. $ref = ProcessExecutor::escape($target->getSourceReference());
  11332. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11333. if (!$this->hasMetadataRepository($path)) {
  11334. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11335. }
  11336. $command = sprintf('fossil pull && fossil up %s', $ref);
  11337. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11338. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11339. }
  11340. }
  11341. public function getLocalChanges(PackageInterface $package, $path)
  11342. {
  11343. if (!$this->hasMetadataRepository($path)) {
  11344. return null;
  11345. }
  11346. $this->process->execute('fossil changes', $output, realpath($path));
  11347. return trim($output) ?: null;
  11348. }
  11349. protected function getCommitLogs($fromReference, $toReference, $path)
  11350. {
  11351. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  11352. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11353. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11354. }
  11355. $log = '';
  11356. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  11357. foreach ($this->process->splitLines($output) as $line) {
  11358. if (preg_match($match, $line)) {
  11359. break;
  11360. }
  11361. $log .= $line;
  11362. }
  11363. return $log;
  11364. }
  11365. protected function hasMetadataRepository($path)
  11366. {
  11367. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  11368. }
  11369. }
  11370. <?php
  11371. namespace Composer\Downloader;
  11372. use Composer\Config;
  11373. use Composer\IO\IOInterface;
  11374. use Composer\Package\PackageInterface;
  11375. use Composer\Util\Filesystem;
  11376. use Composer\Util\Git as GitUtil;
  11377. use Composer\Util\Platform;
  11378. use Composer\Util\ProcessExecutor;
  11379. use Composer\Cache;
  11380. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  11381. {
  11382. private $hasStashedChanges = false;
  11383. private $hasDiscardedChanges = false;
  11384. private $gitUtil;
  11385. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11386. {
  11387. parent::__construct($io, $config, $process, $fs);
  11388. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  11389. }
  11390. public function doDownload(PackageInterface $package, $path, $url)
  11391. {
  11392. GitUtil::cleanEnv();
  11393. $path = $this->normalizePath($path);
  11394. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  11395. $ref = $package->getSourceReference();
  11396. $flag = Platform::isWindows() ? '/D ' : '';
  11397. $gitVersion = GitUtil::getVersion($this->process);
  11398. $msg = "Cloning ".$this->getShortHash($ref);
  11399. $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%';
  11400. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  11401. $this->io->writeError('', true, IOInterface::DEBUG);
  11402. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  11403. try {
  11404. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  11405. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  11406. }
  11407. if (is_dir($cachePath)) {
  11408. $command =
  11409. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  11410. . '&& cd '.$flag.'%path% '
  11411. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  11412. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  11413. }
  11414. } catch (\RuntimeException $e) {
  11415. if (0 === strpos(get_class($e), 'PHPUnit')) {
  11416. throw $e;
  11417. }
  11418. }
  11419. }
  11420. $this->io->writeError($msg);
  11421. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  11422. return str_replace(
  11423. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  11424. array(
  11425. ProcessExecutor::escape($url),
  11426. ProcessExecutor::escape($path),
  11427. ProcessExecutor::escape($cachePath),
  11428. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  11429. ),
  11430. $command
  11431. );
  11432. };
  11433. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  11434. if ($url !== $package->getSourceUrl()) {
  11435. $this->updateOriginUrl($path, $package->getSourceUrl());
  11436. } else {
  11437. $this->setPushUrl($path, $url);
  11438. }
  11439. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  11440. if ($package->getDistReference() === $package->getSourceReference()) {
  11441. $package->setDistReference($newRef);
  11442. }
  11443. $package->setSourceReference($newRef);
  11444. }
  11445. }
  11446. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11447. {
  11448. GitUtil::cleanEnv();
  11449. if (!$this->hasMetadataRepository($path)) {
  11450. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11451. }
  11452. $updateOriginUrl = false;
  11453. if (
  11454. 0 === $this->process->execute('git remote -v', $output, $path)
  11455. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  11456. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  11457. ) {
  11458. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  11459. $updateOriginUrl = true;
  11460. }
  11461. }
  11462. $ref = $target->getSourceReference();
  11463. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  11464. $command = '(git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)) && git remote set-url composer %s';
  11465. $commandCallable = function ($url) use ($command, $ref) {
  11466. return sprintf(
  11467. $command,
  11468. ProcessExecutor::escape($url),
  11469. ProcessExecutor::escape($ref.'^{commit}'),
  11470. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  11471. );
  11472. };
  11473. $this->gitUtil->runCommand($commandCallable, $url, $path);
  11474. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  11475. if ($target->getDistReference() === $target->getSourceReference()) {
  11476. $target->setDistReference($newRef);
  11477. }
  11478. $target->setSourceReference($newRef);
  11479. }
  11480. if ($updateOriginUrl) {
  11481. $this->updateOriginUrl($path, $target->getSourceUrl());
  11482. }
  11483. }
  11484. public function getLocalChanges(PackageInterface $package, $path)
  11485. {
  11486. GitUtil::cleanEnv();
  11487. if (!$this->hasMetadataRepository($path)) {
  11488. return;
  11489. }
  11490. $command = 'git status --porcelain --untracked-files=no';
  11491. if (0 !== $this->process->execute($command, $output, $path)) {
  11492. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11493. }
  11494. return trim($output) ?: null;
  11495. }
  11496. public function getUnpushedChanges(PackageInterface $package, $path)
  11497. {
  11498. GitUtil::cleanEnv();
  11499. $path = $this->normalizePath($path);
  11500. if (!$this->hasMetadataRepository($path)) {
  11501. return;
  11502. }
  11503. $command = 'git show-ref --head -d';
  11504. if (0 !== $this->process->execute($command, $output, $path)) {
  11505. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11506. }
  11507. $refs = trim($output);
  11508. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  11509. return;
  11510. }
  11511. $headRef = $match[1];
  11512. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  11513. return;
  11514. }
  11515. $branch = $matches[1][0];
  11516. $unpushedChanges = null;
  11517. for ($i = 0; $i <= 1; $i++) {
  11518. foreach ($matches[1] as $candidate) {
  11519. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  11520. $branch = $candidate;
  11521. $remoteBranch = $match[1];
  11522. break;
  11523. }
  11524. }
  11525. if (!isset($remoteBranch)) {
  11526. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  11527. } else {
  11528. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  11529. if (0 !== $this->process->execute($command, $output, $path)) {
  11530. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11531. }
  11532. $unpushedChanges = trim($output) ?: null;
  11533. }
  11534. if ($unpushedChanges && $i === 0) {
  11535. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  11536. }
  11537. if (!$unpushedChanges) {
  11538. break;
  11539. }
  11540. }
  11541. return $unpushedChanges;
  11542. }
  11543. protected function cleanChanges(PackageInterface $package, $path, $update)
  11544. {
  11545. GitUtil::cleanEnv();
  11546. $path = $this->normalizePath($path);
  11547. $unpushed = $this->getUnpushedChanges($package, $path);
  11548. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  11549. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  11550. }
  11551. if (!$changes = $this->getLocalChanges($package, $path)) {
  11552. return;
  11553. }
  11554. if (!$this->io->isInteractive()) {
  11555. $discardChanges = $this->config->get('discard-changes');
  11556. if (true === $discardChanges) {
  11557. return $this->discardChanges($path);
  11558. }
  11559. if ('stash' === $discardChanges) {
  11560. if (!$update) {
  11561. return parent::cleanChanges($package, $path, $update);
  11562. }
  11563. return $this->stashChanges($path);
  11564. }
  11565. return parent::cleanChanges($package, $path, $update);
  11566. }
  11567. $changes = array_map(function ($elem) {
  11568. return ' '.$elem;
  11569. }, preg_split('{\s*\r?\n\s*}', $changes));
  11570. $this->io->writeError(' <error>The package has modified files:</error>');
  11571. $this->io->writeError(array_slice($changes, 0, 10));
  11572. if (count($changes) > 10) {
  11573. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  11574. }
  11575. while (true) {
  11576. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  11577. case 'y':
  11578. $this->discardChanges($path);
  11579. break 2;
  11580. case 's':
  11581. if (!$update) {
  11582. goto help;
  11583. }
  11584. $this->stashChanges($path);
  11585. break 2;
  11586. case 'n':
  11587. throw new \RuntimeException('Update aborted');
  11588. case 'v':
  11589. $this->io->writeError($changes);
  11590. break;
  11591. case 'd':
  11592. $this->viewDiff($path);
  11593. break;
  11594. case '?':
  11595. default:
  11596. help:
  11597. $this->io->writeError(array(
  11598. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11599. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11600. ' v - view modified files',
  11601. ' d - view local modifications (diff)',
  11602. ));
  11603. if ($update) {
  11604. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11605. }
  11606. $this->io->writeError(' ? - print help');
  11607. break;
  11608. }
  11609. }
  11610. }
  11611. protected function reapplyChanges($path)
  11612. {
  11613. $path = $this->normalizePath($path);
  11614. if ($this->hasStashedChanges) {
  11615. $this->hasStashedChanges = false;
  11616. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11617. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11618. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11619. }
  11620. }
  11621. $this->hasDiscardedChanges = false;
  11622. }
  11623. protected function updateToCommit($path, $reference, $branch, $date)
  11624. {
  11625. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11626. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11627. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11628. $branches = null;
  11629. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11630. $branches = $output;
  11631. }
  11632. $gitRef = $reference;
  11633. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11634. && $branches
  11635. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11636. ) {
  11637. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11638. if (0 === $this->process->execute($command, $output, $path)) {
  11639. return;
  11640. }
  11641. }
  11642. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11643. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11644. $branch = 'v' . $branch;
  11645. }
  11646. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11647. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11648. if (0 === $this->process->execute($command, $output, $path)
  11649. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11650. ) {
  11651. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11652. if (0 === $this->process->execute($command, $output, $path)) {
  11653. return;
  11654. }
  11655. }
  11656. }
  11657. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11658. if (0 === $this->process->execute($command, $output, $path)) {
  11659. return;
  11660. }
  11661. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11662. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11663. }
  11664. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11665. }
  11666. protected function updateOriginUrl($path, $url)
  11667. {
  11668. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11669. $this->setPushUrl($path, $url);
  11670. }
  11671. protected function setPushUrl($path, $url)
  11672. {
  11673. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11674. $protocols = $this->config->get('github-protocols');
  11675. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11676. if (!in_array('ssh', $protocols, true)) {
  11677. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11678. }
  11679. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11680. $this->process->execute($cmd, $ignoredOutput, $path);
  11681. }
  11682. }
  11683. protected function getCommitLogs($fromReference, $toReference, $path)
  11684. {
  11685. $path = $this->normalizePath($path);
  11686. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11687. if (0 !== $this->process->execute($command, $output, $path)) {
  11688. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11689. }
  11690. return $output;
  11691. }
  11692. protected function discardChanges($path)
  11693. {
  11694. $path = $this->normalizePath($path);
  11695. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  11696. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11697. }
  11698. $this->hasDiscardedChanges = true;
  11699. }
  11700. protected function stashChanges($path)
  11701. {
  11702. $path = $this->normalizePath($path);
  11703. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11704. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11705. }
  11706. $this->hasStashedChanges = true;
  11707. }
  11708. protected function viewDiff($path)
  11709. {
  11710. $path = $this->normalizePath($path);
  11711. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11712. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11713. }
  11714. $this->io->writeError($output);
  11715. }
  11716. protected function normalizePath($path)
  11717. {
  11718. if (Platform::isWindows() && strlen($path) > 0) {
  11719. $basePath = $path;
  11720. $removed = array();
  11721. while (!is_dir($basePath) && $basePath !== '\\') {
  11722. array_unshift($removed, basename($basePath));
  11723. $basePath = dirname($basePath);
  11724. }
  11725. if ($basePath === '\\') {
  11726. return $path;
  11727. }
  11728. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11729. }
  11730. return $path;
  11731. }
  11732. protected function hasMetadataRepository($path)
  11733. {
  11734. $path = $this->normalizePath($path);
  11735. return is_dir($path.'/.git');
  11736. }
  11737. protected function getShortHash($reference)
  11738. {
  11739. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11740. return substr($reference, 0, 10);
  11741. }
  11742. return $reference;
  11743. }
  11744. }
  11745. <?php
  11746. namespace Composer\Downloader;
  11747. use Composer\Config;
  11748. use Composer\Cache;
  11749. use Composer\EventDispatcher\EventDispatcher;
  11750. use Composer\Package\PackageInterface;
  11751. use Composer\Util\Platform;
  11752. use Composer\Util\ProcessExecutor;
  11753. use Composer\Util\RemoteFilesystem;
  11754. use Composer\IO\IOInterface;
  11755. class GzipDownloader extends ArchiveDownloader
  11756. {
  11757. protected $process;
  11758. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11759. {
  11760. $this->process = $process ?: new ProcessExecutor($io);
  11761. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11762. }
  11763. protected function extract($file, $path)
  11764. {
  11765. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11766. if (!Platform::isWindows()) {
  11767. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11768. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11769. return;
  11770. }
  11771. if (extension_loaded('zlib')) {
  11772. $this->extractUsingExt($file, $targetFilepath);
  11773. return;
  11774. }
  11775. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11776. throw new \RuntimeException($processError);
  11777. }
  11778. $this->extractUsingExt($file, $targetFilepath);
  11779. }
  11780. protected function getFileName(PackageInterface $package, $path)
  11781. {
  11782. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11783. }
  11784. private function extractUsingExt($file, $targetFilepath)
  11785. {
  11786. $archiveFile = gzopen($file, 'rb');
  11787. $targetFile = fopen($targetFilepath, 'wb');
  11788. while ($string = gzread($archiveFile, 4096)) {
  11789. fwrite($targetFile, $string, Platform::strlen($string));
  11790. }
  11791. gzclose($archiveFile);
  11792. fclose($targetFile);
  11793. }
  11794. }
  11795. <?php
  11796. namespace Composer\Downloader;
  11797. use Composer\Package\PackageInterface;
  11798. use Composer\Util\ProcessExecutor;
  11799. use Composer\Util\Hg as HgUtils;
  11800. class HgDownloader extends VcsDownloader
  11801. {
  11802. public function doDownload(PackageInterface $package, $path, $url)
  11803. {
  11804. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11805. $cloneCommand = function ($url) use ($path) {
  11806. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11807. };
  11808. $hgUtils->runCommand($cloneCommand, $url, $path);
  11809. $ref = ProcessExecutor::escape($package->getSourceReference());
  11810. $command = sprintf('hg up %s', $ref);
  11811. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11812. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11813. }
  11814. }
  11815. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11816. {
  11817. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11818. $ref = $target->getSourceReference();
  11819. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11820. if (!$this->hasMetadataRepository($path)) {
  11821. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11822. }
  11823. $command = function ($url) use ($ref) {
  11824. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11825. };
  11826. $hgUtils->runCommand($command, $url, $path);
  11827. }
  11828. public function getLocalChanges(PackageInterface $package, $path)
  11829. {
  11830. if (!is_dir($path.'/.hg')) {
  11831. return null;
  11832. }
  11833. $this->process->execute('hg st', $output, realpath($path));
  11834. return trim($output) ?: null;
  11835. }
  11836. protected function getCommitLogs($fromReference, $toReference, $path)
  11837. {
  11838. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11839. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11840. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11841. }
  11842. return $output;
  11843. }
  11844. protected function hasMetadataRepository($path)
  11845. {
  11846. return is_dir($path . '/.hg');
  11847. }
  11848. }
  11849. <?php
  11850. namespace Composer\Downloader;
  11851. use Composer\Package\Archiver\ArchivableFilesFinder;
  11852. use Composer\Package\Dumper\ArrayDumper;
  11853. use Composer\Package\PackageInterface;
  11854. use Composer\Package\Version\VersionGuesser;
  11855. use Composer\Package\Version\VersionParser;
  11856. use Composer\Util\Platform;
  11857. use Composer\Util\ProcessExecutor;
  11858. use Composer\Util\Filesystem as ComposerFilesystem;
  11859. use Symfony\Component\Filesystem\Exception\IOException;
  11860. use Symfony\Component\Filesystem\Filesystem;
  11861. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11862. {
  11863. const STRATEGY_SYMLINK = 10;
  11864. const STRATEGY_MIRROR = 20;
  11865. public function download(PackageInterface $package, $path, $output = true)
  11866. {
  11867. $url = $package->getDistUrl();
  11868. $realUrl = realpath($url);
  11869. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11870. throw new \RuntimeException(sprintf(
  11871. 'Source path "%s" is not found for package %s',
  11872. $url,
  11873. $package->getName()
  11874. ));
  11875. }
  11876. if (realpath($path) === $realUrl) {
  11877. if ($output) {
  11878. $this->io->writeError(sprintf(
  11879. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11880. $package->getName(),
  11881. $package->getFullPrettyVersion()
  11882. ));
  11883. }
  11884. return;
  11885. }
  11886. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11887. throw new \RuntimeException(sprintf(
  11888. 'Package %s cannot install to "%s" inside its source at "%s"',
  11889. $package->getName(),
  11890. realpath($path),
  11891. $realUrl
  11892. ));
  11893. }
  11894. $transportOptions = $package->getTransportOptions() + array('symlink' => null, 'relative' => true);
  11895. $currentStrategy = self::STRATEGY_SYMLINK;
  11896. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11897. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11898. if ($mirrorPathRepos) {
  11899. $currentStrategy = self::STRATEGY_MIRROR;
  11900. }
  11901. if (true === $transportOptions['symlink']) {
  11902. $currentStrategy = self::STRATEGY_SYMLINK;
  11903. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11904. } elseif (false === $transportOptions['symlink']) {
  11905. $currentStrategy = self::STRATEGY_MIRROR;
  11906. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11907. }
  11908. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11909. $currentStrategy = self::STRATEGY_MIRROR;
  11910. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11911. }
  11912. $fileSystem = new Filesystem();
  11913. $this->filesystem->removeDirectory($path);
  11914. if ($output) {
  11915. $this->io->writeError(sprintf(
  11916. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11917. $package->getName(),
  11918. $package->getFullPrettyVersion()
  11919. ), false);
  11920. }
  11921. $isFallback = false;
  11922. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11923. try {
  11924. if (Platform::isWindows()) {
  11925. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11926. $this->filesystem->junction($realUrl, $path);
  11927. } else {
  11928. $absolutePath = $path;
  11929. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11930. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11931. }
  11932. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11933. $path = rtrim($path, "/");
  11934. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11935. if ($transportOptions['relative']) {
  11936. $fileSystem->symlink($shortestPath, $path);
  11937. } else {
  11938. $fileSystem->symlink($realUrl, $path);
  11939. }
  11940. }
  11941. } catch (IOException $e) {
  11942. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11943. $this->io->writeError('');
  11944. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11945. $currentStrategy = self::STRATEGY_MIRROR;
  11946. $isFallback = true;
  11947. } else {
  11948. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11949. }
  11950. }
  11951. }
  11952. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11953. $fs = new ComposerFilesystem();
  11954. $realUrl = $fs->normalizePath($realUrl);
  11955. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11956. $iterator = new ArchivableFilesFinder($realUrl, array());
  11957. $fileSystem->mirror($realUrl, $path, $iterator);
  11958. }
  11959. $this->io->writeError('');
  11960. }
  11961. public function remove(PackageInterface $package, $path, $output = true)
  11962. {
  11963. $realUrl = realpath($package->getDistUrl());
  11964. if (realpath($path) === $realUrl) {
  11965. if ($output) {
  11966. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11967. }
  11968. return;
  11969. }
  11970. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11971. if ($output) {
  11972. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11973. }
  11974. if (!$this->filesystem->removeJunction($path)) {
  11975. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11976. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11977. }
  11978. } else {
  11979. parent::remove($package, $path, $output);
  11980. }
  11981. }
  11982. public function getVcsReference(PackageInterface $package, $path)
  11983. {
  11984. $parser = new VersionParser;
  11985. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11986. $dumper = new ArrayDumper;
  11987. $packageConfig = $dumper->dump($package);
  11988. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11989. return $packageVersion['commit'];
  11990. }
  11991. }
  11992. private function safeJunctions()
  11993. {
  11994. return function_exists('proc_open') &&
  11995. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11996. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11997. }
  11998. }
  11999. <?php
  12000. namespace Composer\Downloader;
  12001. use Composer\Util\Filesystem;
  12002. class PearPackageExtractor
  12003. {
  12004. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  12005. private $filesystem;
  12006. private $file;
  12007. public function __construct($file)
  12008. {
  12009. if (!is_file($file)) {
  12010. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  12011. }
  12012. $this->filesystem = new Filesystem();
  12013. $this->file = $file;
  12014. }
  12015. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  12016. {
  12017. $extractionPath = $target.'/tarball';
  12018. try {
  12019. $archive = new \PharData($this->file);
  12020. $archive->extractTo($extractionPath, null, true);
  12021. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  12022. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  12023. }
  12024. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  12025. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  12026. $this->filesystem->removeDirectory($extractionPath);
  12027. } catch (\Exception $exception) {
  12028. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  12029. }
  12030. }
  12031. private function copyFiles($files, $source, $target, $roles, $vars)
  12032. {
  12033. foreach ($files as $file) {
  12034. $from = $this->combine($source, $file['from']);
  12035. $to = $this->combine($target, $roles[$file['role']]);
  12036. $to = $this->combine($to, $file['to']);
  12037. $tasks = $file['tasks'];
  12038. $this->copyFile($from, $to, $tasks, $vars);
  12039. }
  12040. }
  12041. private function copyFile($from, $to, $tasks, $vars)
  12042. {
  12043. if (!is_file($from)) {
  12044. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  12045. }
  12046. $this->filesystem->ensureDirectoryExists(dirname($to));
  12047. if (0 == count($tasks)) {
  12048. $copied = copy($from, $to);
  12049. } else {
  12050. $content = file_get_contents($from);
  12051. $replacements = array();
  12052. foreach ($tasks as $task) {
  12053. $pattern = $task['from'];
  12054. $varName = $task['to'];
  12055. if (isset($vars[$varName])) {
  12056. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  12057. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  12058. } else {
  12059. $replacements[$pattern] = $vars[$varName];
  12060. }
  12061. }
  12062. }
  12063. $content = strtr($content, $replacements);
  12064. $copied = file_put_contents($to, $content);
  12065. }
  12066. if (false === $copied) {
  12067. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  12068. }
  12069. }
  12070. private function buildCopyActions($source, array $roles, $vars)
  12071. {
  12072. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  12073. if (false === $package) {
  12074. throw new \RuntimeException('Package definition file is not valid.');
  12075. }
  12076. $packageSchemaVersion = $package['version'];
  12077. if ('1.0' == $packageSchemaVersion) {
  12078. $children = $package->release->filelist->children();
  12079. $packageName = (string) $package->name;
  12080. $packageVersion = (string) $package->release->version;
  12081. $sourceDir = $packageName . '-' . $packageVersion;
  12082. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  12083. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  12084. $children = $package->contents->children();
  12085. $packageName = (string) $package->name;
  12086. $packageVersion = (string) $package->version->release;
  12087. $sourceDir = $packageName . '-' . $packageVersion;
  12088. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  12089. $namespaces = $package->getNamespaces();
  12090. $package->registerXPathNamespace('ns', $namespaces['']);
  12091. $releaseNodes = $package->xpath('ns:phprelease');
  12092. $this->applyRelease($result, $releaseNodes, $vars);
  12093. } else {
  12094. throw new \RuntimeException('Unsupported schema version of package definition file.');
  12095. }
  12096. return $result;
  12097. }
  12098. private function applyRelease(&$actions, $releaseNodes, $vars)
  12099. {
  12100. foreach ($releaseNodes as $releaseNode) {
  12101. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  12102. if ($requiredOs && $vars['os'] != $requiredOs) {
  12103. continue;
  12104. }
  12105. if ($releaseNode->filelist) {
  12106. foreach ($releaseNode->filelist->children() as $action) {
  12107. if ('install' == $action->getName()) {
  12108. $name = (string) $action['name'];
  12109. $as = (string) $action['as'];
  12110. if (isset($actions[$name])) {
  12111. $actions[$name]['to'] = $as;
  12112. }
  12113. } elseif ('ignore' == $action->getName()) {
  12114. $name = (string) $action['name'];
  12115. unset($actions[$name]);
  12116. } else {
  12117. }
  12118. }
  12119. }
  12120. break;
  12121. }
  12122. }
  12123. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  12124. {
  12125. $result = array();
  12126. foreach ($children as $child) {
  12127. if ($child->getName() == 'dir') {
  12128. $dirSource = $this->combine($source, (string) $child['name']);
  12129. $dirTarget = $child['baseinstalldir'] ?: $target;
  12130. $dirRole = $child['role'] ?: $role;
  12131. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12132. $result = array_merge($result, $dirFiles);
  12133. } elseif ($child->getName() == 'file') {
  12134. $fileRole = (string) $child['role'] ?: $role;
  12135. if (isset($targetRoles[$fileRole])) {
  12136. $fileName = (string) ($child['name'] ?: $child[0]);
  12137. $fileSource = $this->combine($source, $fileName);
  12138. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  12139. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12140. $fileTarget = $packageName . '/' . $fileTarget;
  12141. }
  12142. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  12143. }
  12144. }
  12145. }
  12146. return $result;
  12147. }
  12148. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  12149. {
  12150. $result = array();
  12151. foreach ($children as $child) {
  12152. if ('dir' == $child->getName()) {
  12153. $dirSource = $this->combine($source, $child['name']);
  12154. $dirTarget = $child['baseinstalldir'] ?: $target;
  12155. $dirRole = $child['role'] ?: $role;
  12156. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12157. $result = array_merge($result, $dirFiles);
  12158. } elseif ('file' == $child->getName()) {
  12159. $fileRole = (string) $child['role'] ?: $role;
  12160. if (isset($targetRoles[$fileRole])) {
  12161. $fileSource = $this->combine($source, (string) $child['name']);
  12162. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  12163. $fileTasks = array();
  12164. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  12165. if ('replace' == $taskNode->getName()) {
  12166. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  12167. }
  12168. }
  12169. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12170. $fileTarget = $packageName . '/' . $fileTarget;
  12171. }
  12172. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  12173. }
  12174. }
  12175. }
  12176. return $result;
  12177. }
  12178. private function combine($left, $right)
  12179. {
  12180. return rtrim($left, '/') . '/' . ltrim($right, '/');
  12181. }
  12182. }
  12183. <?php
  12184. namespace Composer\Downloader;
  12185. use Composer\Package\PackageInterface;
  12186. use Composer\Repository\VcsRepository;
  12187. use Composer\Util\Perforce;
  12188. class PerforceDownloader extends VcsDownloader
  12189. {
  12190. protected $perforce;
  12191. public function doDownload(PackageInterface $package, $path, $url)
  12192. {
  12193. $ref = $package->getSourceReference();
  12194. $label = $this->getLabelFromSourceReference($ref);
  12195. $this->io->writeError('Cloning ' . $ref);
  12196. $this->initPerforce($package, $path, $url);
  12197. $this->perforce->setStream($ref);
  12198. $this->perforce->p4Login();
  12199. $this->perforce->writeP4ClientSpec();
  12200. $this->perforce->connectClient();
  12201. $this->perforce->syncCodeBase($label);
  12202. $this->perforce->cleanupClientSpec();
  12203. }
  12204. private function getLabelFromSourceReference($ref)
  12205. {
  12206. $pos = strpos($ref, '@');
  12207. if (false !== $pos) {
  12208. return substr($ref, $pos + 1);
  12209. }
  12210. return null;
  12211. }
  12212. public function initPerforce(PackageInterface $package, $path, $url)
  12213. {
  12214. if (!empty($this->perforce)) {
  12215. $this->perforce->initializePath($path);
  12216. return;
  12217. }
  12218. $repository = $package->getRepository();
  12219. $repoConfig = null;
  12220. if ($repository instanceof VcsRepository) {
  12221. $repoConfig = $this->getRepoConfig($repository);
  12222. }
  12223. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  12224. }
  12225. private function getRepoConfig(VcsRepository $repository)
  12226. {
  12227. return $repository->getRepoConfig();
  12228. }
  12229. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12230. {
  12231. $this->doDownload($target, $path, $url);
  12232. }
  12233. public function getLocalChanges(PackageInterface $package, $path)
  12234. {
  12235. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  12236. }
  12237. protected function getCommitLogs($fromReference, $toReference, $path)
  12238. {
  12239. return $this->perforce->getCommitLogs($fromReference, $toReference);
  12240. }
  12241. public function setPerforce($perforce)
  12242. {
  12243. $this->perforce = $perforce;
  12244. }
  12245. protected function hasMetadataRepository($path)
  12246. {
  12247. return true;
  12248. }
  12249. }
  12250. <?php
  12251. namespace Composer\Downloader;
  12252. class PharDownloader extends ArchiveDownloader
  12253. {
  12254. protected function extract($file, $path)
  12255. {
  12256. $archive = new \Phar($file);
  12257. $archive->extractTo($path, null, true);
  12258. }
  12259. }
  12260. <?php
  12261. namespace Composer\Downloader;
  12262. use Composer\Config;
  12263. use Composer\Cache;
  12264. use Composer\EventDispatcher\EventDispatcher;
  12265. use Composer\Util\IniHelper;
  12266. use Composer\Util\Platform;
  12267. use Composer\Util\ProcessExecutor;
  12268. use Composer\Util\RemoteFilesystem;
  12269. use Composer\IO\IOInterface;
  12270. use RarArchive;
  12271. class RarDownloader extends ArchiveDownloader
  12272. {
  12273. protected $process;
  12274. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12275. {
  12276. $this->process = $process ?: new ProcessExecutor($io);
  12277. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12278. }
  12279. protected function extract($file, $path)
  12280. {
  12281. $processError = null;
  12282. if (!Platform::isWindows()) {
  12283. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  12284. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12285. return;
  12286. }
  12287. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12288. }
  12289. if (!class_exists('RarArchive')) {
  12290. $iniMessage = IniHelper::getMessage();
  12291. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  12292. . $iniMessage . "\n" . $processError;
  12293. if (!Platform::isWindows()) {
  12294. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  12295. }
  12296. throw new \RuntimeException($error);
  12297. }
  12298. $rarArchive = RarArchive::open($file);
  12299. if (false === $rarArchive) {
  12300. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  12301. }
  12302. $entries = $rarArchive->getEntries();
  12303. if (false === $entries) {
  12304. throw new \RuntimeException('Could not retrieve RAR archive entries');
  12305. }
  12306. foreach ($entries as $entry) {
  12307. if (false === $entry->extract($path)) {
  12308. throw new \RuntimeException('Could not extract entry');
  12309. }
  12310. }
  12311. $rarArchive->close();
  12312. }
  12313. }
  12314. <?php
  12315. namespace Composer\Downloader;
  12316. use Composer\Package\PackageInterface;
  12317. use Composer\Util\Svn as SvnUtil;
  12318. use Composer\Repository\VcsRepository;
  12319. use Composer\Util\ProcessExecutor;
  12320. class SvnDownloader extends VcsDownloader
  12321. {
  12322. protected $cacheCredentials = true;
  12323. public function doDownload(PackageInterface $package, $path, $url)
  12324. {
  12325. SvnUtil::cleanEnv();
  12326. $ref = $package->getSourceReference();
  12327. $repo = $package->getRepository();
  12328. if ($repo instanceof VcsRepository) {
  12329. $repoConfig = $repo->getRepoConfig();
  12330. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  12331. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  12332. }
  12333. }
  12334. $this->io->writeError(" Checking out ".$package->getSourceReference());
  12335. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  12336. }
  12337. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12338. {
  12339. SvnUtil::cleanEnv();
  12340. $ref = $target->getSourceReference();
  12341. if (!$this->hasMetadataRepository($path)) {
  12342. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  12343. }
  12344. $util = new SvnUtil($url, $this->io, $this->config);
  12345. $flags = "";
  12346. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  12347. $flags .= ' --ignore-ancestry';
  12348. }
  12349. $this->io->writeError(" Checking out " . $ref);
  12350. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  12351. }
  12352. public function getLocalChanges(PackageInterface $package, $path)
  12353. {
  12354. if (!$this->hasMetadataRepository($path)) {
  12355. return null;
  12356. }
  12357. $this->process->execute('svn status --ignore-externals', $output, $path);
  12358. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  12359. }
  12360. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  12361. {
  12362. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12363. $util->setCacheCredentials($this->cacheCredentials);
  12364. try {
  12365. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  12366. } catch (\RuntimeException $e) {
  12367. throw new \RuntimeException(
  12368. 'Package could not be downloaded, '.$e->getMessage()
  12369. );
  12370. }
  12371. }
  12372. protected function cleanChanges(PackageInterface $package, $path, $update)
  12373. {
  12374. if (!$changes = $this->getLocalChanges($package, $path)) {
  12375. return;
  12376. }
  12377. if (!$this->io->isInteractive()) {
  12378. if (true === $this->config->get('discard-changes')) {
  12379. return $this->discardChanges($path);
  12380. }
  12381. return parent::cleanChanges($package, $path, $update);
  12382. }
  12383. $changes = array_map(function ($elem) {
  12384. return ' '.$elem;
  12385. }, preg_split('{\s*\r?\n\s*}', $changes));
  12386. $countChanges = count($changes);
  12387. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  12388. $this->io->writeError(array_slice($changes, 0, 10));
  12389. if ($countChanges > 10) {
  12390. $remainingChanges = $countChanges - 10;
  12391. $this->io->writeError(
  12392. sprintf(
  12393. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  12394. $remainingChanges === 1 ? '' : 's'
  12395. )
  12396. );
  12397. }
  12398. while (true) {
  12399. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  12400. case 'y':
  12401. $this->discardChanges($path);
  12402. break 2;
  12403. case 'n':
  12404. throw new \RuntimeException('Update aborted');
  12405. case 'v':
  12406. $this->io->writeError($changes);
  12407. break;
  12408. case '?':
  12409. default:
  12410. $this->io->writeError(array(
  12411. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  12412. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  12413. ' v - view modified files',
  12414. ' ? - print help',
  12415. ));
  12416. break;
  12417. }
  12418. }
  12419. }
  12420. protected function getCommitLogs($fromReference, $toReference, $path)
  12421. {
  12422. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  12423. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  12424. if (0 !== $this->process->execute($command, $output, $path)) {
  12425. throw new \RuntimeException(
  12426. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  12427. );
  12428. }
  12429. $urlPattern = '#<url>(.*)</url>#';
  12430. if (preg_match($urlPattern, $output, $matches)) {
  12431. $baseUrl = $matches[1];
  12432. } else {
  12433. throw new \RuntimeException(
  12434. 'Unable to determine svn url for path '. $path
  12435. );
  12436. }
  12437. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  12438. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  12439. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  12440. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12441. $util->setCacheCredentials($this->cacheCredentials);
  12442. try {
  12443. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  12444. } catch (\RuntimeException $e) {
  12445. throw new \RuntimeException(
  12446. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  12447. );
  12448. }
  12449. }
  12450. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  12451. }
  12452. protected function discardChanges($path)
  12453. {
  12454. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  12455. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  12456. }
  12457. }
  12458. protected function hasMetadataRepository($path)
  12459. {
  12460. return is_dir($path.'/.svn');
  12461. }
  12462. }
  12463. <?php
  12464. namespace Composer\Downloader;
  12465. class TarDownloader extends ArchiveDownloader
  12466. {
  12467. protected function extract($file, $path)
  12468. {
  12469. $archive = new \PharData($file);
  12470. $archive->extractTo($path, null, true);
  12471. }
  12472. }
  12473. <?php
  12474. namespace Composer\Downloader;
  12475. class TransportException extends \RuntimeException
  12476. {
  12477. protected $headers;
  12478. protected $response;
  12479. protected $statusCode;
  12480. public function setHeaders($headers)
  12481. {
  12482. $this->headers = $headers;
  12483. }
  12484. public function getHeaders()
  12485. {
  12486. return $this->headers;
  12487. }
  12488. public function setResponse($response)
  12489. {
  12490. $this->response = $response;
  12491. }
  12492. public function getResponse()
  12493. {
  12494. return $this->response;
  12495. }
  12496. public function setStatusCode($statusCode)
  12497. {
  12498. $this->statusCode = $statusCode;
  12499. }
  12500. public function getStatusCode()
  12501. {
  12502. return $this->statusCode;
  12503. }
  12504. }
  12505. <?php
  12506. namespace Composer\Downloader;
  12507. use Composer\Package\PackageInterface;
  12508. interface VcsCapableDownloaderInterface
  12509. {
  12510. public function getVcsReference(PackageInterface $package, $path);
  12511. }
  12512. <?php
  12513. namespace Composer\Downloader;
  12514. use Composer\Config;
  12515. use Composer\Package\Dumper\ArrayDumper;
  12516. use Composer\Package\PackageInterface;
  12517. use Composer\Package\Version\VersionGuesser;
  12518. use Composer\Package\Version\VersionParser;
  12519. use Composer\Util\ProcessExecutor;
  12520. use Composer\IO\IOInterface;
  12521. use Composer\Util\Filesystem;
  12522. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  12523. {
  12524. protected $io;
  12525. protected $config;
  12526. protected $process;
  12527. protected $filesystem;
  12528. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  12529. {
  12530. $this->io = $io;
  12531. $this->config = $config;
  12532. $this->process = $process ?: new ProcessExecutor($io);
  12533. $this->filesystem = $fs ?: new Filesystem($this->process);
  12534. }
  12535. public function getInstallationSource()
  12536. {
  12537. return 'source';
  12538. }
  12539. public function download(PackageInterface $package, $path)
  12540. {
  12541. if (!$package->getSourceReference()) {
  12542. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  12543. }
  12544. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  12545. $this->filesystem->emptyDirectory($path);
  12546. $urls = $package->getSourceUrls();
  12547. while ($url = array_shift($urls)) {
  12548. try {
  12549. if (Filesystem::isLocalPath($url)) {
  12550. $needle = 'file://';
  12551. $isFileProtocol = false;
  12552. if (0 === strpos($url, $needle)) {
  12553. $url = substr($url, strlen($needle));
  12554. $isFileProtocol = true;
  12555. }
  12556. if (false !== strpos($url, '%')) {
  12557. $url = rawurldecode($url);
  12558. }
  12559. $url = realpath($url);
  12560. if ($isFileProtocol) {
  12561. $url = $needle . $url;
  12562. }
  12563. }
  12564. $this->doDownload($package, $path, $url);
  12565. break;
  12566. } catch (\Exception $e) {
  12567. if ($e instanceof \PHPUnit_Framework_Exception) {
  12568. throw $e;
  12569. }
  12570. if ($this->io->isDebug()) {
  12571. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  12572. } elseif (count($urls)) {
  12573. $this->io->writeError(' Failed, trying the next URL');
  12574. }
  12575. if (!count($urls)) {
  12576. throw $e;
  12577. }
  12578. }
  12579. }
  12580. }
  12581. public function update(PackageInterface $initial, PackageInterface $target, $path)
  12582. {
  12583. if (!$target->getSourceReference()) {
  12584. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  12585. }
  12586. $name = $target->getName();
  12587. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12588. if ($target->getSourceType() === 'svn') {
  12589. $from = $initial->getSourceReference();
  12590. $to = $target->getSourceReference();
  12591. } else {
  12592. $from = substr($initial->getSourceReference(), 0, 7);
  12593. $to = substr($target->getSourceReference(), 0, 7);
  12594. }
  12595. $name .= ' '.$initial->getPrettyVersion();
  12596. } else {
  12597. $from = $initial->getFullPrettyVersion();
  12598. $to = $target->getFullPrettyVersion();
  12599. }
  12600. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12601. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12602. $this->cleanChanges($initial, $path, true);
  12603. $urls = $target->getSourceUrls();
  12604. $exception = null;
  12605. while ($url = array_shift($urls)) {
  12606. try {
  12607. if (Filesystem::isLocalPath($url)) {
  12608. $url = realpath($url);
  12609. }
  12610. $this->doUpdate($initial, $target, $path, $url);
  12611. $exception = null;
  12612. break;
  12613. } catch (\Exception $exception) {
  12614. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12615. throw $exception;
  12616. }
  12617. if ($this->io->isDebug()) {
  12618. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12619. } elseif (count($urls)) {
  12620. $this->io->writeError(' Failed, trying the next URL');
  12621. }
  12622. }
  12623. }
  12624. $this->reapplyChanges($path);
  12625. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12626. $message = 'Pulling in changes:';
  12627. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12628. if (!trim($logs)) {
  12629. $message = 'Rolling back changes:';
  12630. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12631. }
  12632. if (trim($logs)) {
  12633. $logs = implode("\n", array_map(function ($line) {
  12634. return ' ' . $line;
  12635. }, explode("\n", $logs)));
  12636. $logs = str_replace('<', '\<', $logs);
  12637. $this->io->writeError(' '.$message);
  12638. $this->io->writeError($logs);
  12639. }
  12640. }
  12641. if (!$urls && $exception) {
  12642. throw $exception;
  12643. }
  12644. }
  12645. public function remove(PackageInterface $package, $path)
  12646. {
  12647. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12648. $this->cleanChanges($package, $path, false);
  12649. if (!$this->filesystem->removeDirectory($path)) {
  12650. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12651. }
  12652. }
  12653. public function setOutputProgress($outputProgress)
  12654. {
  12655. return $this;
  12656. }
  12657. public function getVcsReference(PackageInterface $package, $path)
  12658. {
  12659. $parser = new VersionParser;
  12660. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12661. $dumper = new ArrayDumper;
  12662. $packageConfig = $dumper->dump($package);
  12663. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12664. return $packageVersion['commit'];
  12665. }
  12666. }
  12667. protected function cleanChanges(PackageInterface $package, $path, $update)
  12668. {
  12669. if (null !== $this->getLocalChanges($package, $path)) {
  12670. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12671. }
  12672. }
  12673. protected function reapplyChanges($path)
  12674. {
  12675. }
  12676. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12677. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12678. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12679. abstract protected function hasMetadataRepository($path);
  12680. }
  12681. <?php
  12682. namespace Composer\Downloader;
  12683. use Composer\Config;
  12684. use Composer\Cache;
  12685. use Composer\EventDispatcher\EventDispatcher;
  12686. use Composer\Package\PackageInterface;
  12687. use Composer\Util\ProcessExecutor;
  12688. use Composer\Util\RemoteFilesystem;
  12689. use Composer\IO\IOInterface;
  12690. class XzDownloader extends ArchiveDownloader
  12691. {
  12692. protected $process;
  12693. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12694. {
  12695. $this->process = $process ?: new ProcessExecutor($io);
  12696. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12697. }
  12698. protected function extract($file, $path)
  12699. {
  12700. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12701. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12702. return;
  12703. }
  12704. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12705. throw new \RuntimeException($processError);
  12706. }
  12707. protected function getFileName(PackageInterface $package, $path)
  12708. {
  12709. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12710. }
  12711. }
  12712. <?php
  12713. namespace Composer\Downloader;
  12714. use Composer\Config;
  12715. use Composer\Cache;
  12716. use Composer\EventDispatcher\EventDispatcher;
  12717. use Composer\Package\PackageInterface;
  12718. use Composer\Util\IniHelper;
  12719. use Composer\Util\Platform;
  12720. use Composer\Util\ProcessExecutor;
  12721. use Composer\Util\RemoteFilesystem;
  12722. use Composer\IO\IOInterface;
  12723. use Symfony\Component\Process\ExecutableFinder;
  12724. use ZipArchive;
  12725. class ZipDownloader extends ArchiveDownloader
  12726. {
  12727. protected static $hasSystemUnzip;
  12728. private static $hasZipArchive;
  12729. private static $isWindows;
  12730. protected $process;
  12731. private $zipArchiveObject;
  12732. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12733. {
  12734. $this->process = $process ?: new ProcessExecutor($io);
  12735. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12736. }
  12737. public function download(PackageInterface $package, $path, $output = true)
  12738. {
  12739. if (null === self::$hasSystemUnzip) {
  12740. $finder = new ExecutableFinder;
  12741. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12742. }
  12743. if (null === self::$hasZipArchive) {
  12744. self::$hasZipArchive = class_exists('ZipArchive');
  12745. }
  12746. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12747. $iniMessage = IniHelper::getMessage();
  12748. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12749. throw new \RuntimeException($error);
  12750. }
  12751. if (null === self::$isWindows) {
  12752. self::$isWindows = Platform::isWindows();
  12753. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12754. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12755. $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>");
  12756. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12757. }
  12758. }
  12759. return parent::download($package, $path, $output);
  12760. }
  12761. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12762. {
  12763. if (!self::$hasZipArchive) {
  12764. $isLastChance = true;
  12765. }
  12766. if (!self::$hasSystemUnzip && !$isLastChance) {
  12767. return $this->extractWithZipArchive($file, $path, true);
  12768. }
  12769. $processError = null;
  12770. $overwrite = $isLastChance ? '-o' : '';
  12771. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12772. try {
  12773. if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) {
  12774. return true;
  12775. }
  12776. $processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput());
  12777. } catch (\Exception $e) {
  12778. $processError = $e;
  12779. }
  12780. if ($isLastChance) {
  12781. throw $processError;
  12782. }
  12783. $this->io->writeError(' '.$processError->getMessage());
  12784. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12785. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12786. return $this->extractWithZipArchive($file, $path, true);
  12787. }
  12788. protected function extractWithZipArchive($file, $path, $isLastChance)
  12789. {
  12790. if (!self::$hasSystemUnzip) {
  12791. $isLastChance = true;
  12792. }
  12793. if (!self::$hasZipArchive && !$isLastChance) {
  12794. return $this->extractWithSystemUnzip($file, $path, true);
  12795. }
  12796. $processError = null;
  12797. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12798. try {
  12799. if (true === ($retval = $zipArchive->open($file))) {
  12800. $extractResult = $zipArchive->extractTo($path);
  12801. if (true === $extractResult) {
  12802. $zipArchive->close();
  12803. return true;
  12804. }
  12805. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12806. } else {
  12807. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12808. }
  12809. } catch (\ErrorException $e) {
  12810. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12811. } catch (\Exception $e) {
  12812. $processError = $e;
  12813. }
  12814. if ($isLastChance) {
  12815. throw $processError;
  12816. }
  12817. $this->io->writeError(' '.$processError->getMessage());
  12818. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12819. return $this->extractWithSystemUnzip($file, $path, true);
  12820. }
  12821. public function extract($file, $path)
  12822. {
  12823. if (self::$isWindows) {
  12824. $this->extractWithZipArchive($file, $path, false);
  12825. } else {
  12826. $this->extractWithSystemUnzip($file, $path, false);
  12827. }
  12828. }
  12829. protected function getErrorMessage($retval, $file)
  12830. {
  12831. switch ($retval) {
  12832. case ZipArchive::ER_EXISTS:
  12833. return sprintf("File '%s' already exists.", $file);
  12834. case ZipArchive::ER_INCONS:
  12835. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12836. case ZipArchive::ER_INVAL:
  12837. return sprintf("Invalid argument (%s)", $file);
  12838. case ZipArchive::ER_MEMORY:
  12839. return sprintf("Malloc failure (%s)", $file);
  12840. case ZipArchive::ER_NOENT:
  12841. return sprintf("No such zip file: '%s'", $file);
  12842. case ZipArchive::ER_NOZIP:
  12843. return sprintf("'%s' is not a zip archive.", $file);
  12844. case ZipArchive::ER_OPEN:
  12845. return sprintf("Can't open zip file: %s", $file);
  12846. case ZipArchive::ER_READ:
  12847. return sprintf("Zip read error (%s)", $file);
  12848. case ZipArchive::ER_SEEK:
  12849. return sprintf("Zip seek error (%s)", $file);
  12850. default:
  12851. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12852. }
  12853. }
  12854. }
  12855. <?php
  12856. namespace Composer\EventDispatcher;
  12857. class Event
  12858. {
  12859. protected $name;
  12860. protected $args;
  12861. protected $flags;
  12862. private $propagationStopped = false;
  12863. public function __construct($name, array $args = array(), array $flags = array())
  12864. {
  12865. $this->name = $name;
  12866. $this->args = $args;
  12867. $this->flags = $flags;
  12868. }
  12869. public function getName()
  12870. {
  12871. return $this->name;
  12872. }
  12873. public function getArguments()
  12874. {
  12875. return $this->args;
  12876. }
  12877. public function getFlags()
  12878. {
  12879. return $this->flags;
  12880. }
  12881. public function isPropagationStopped()
  12882. {
  12883. return $this->propagationStopped;
  12884. }
  12885. public function stopPropagation()
  12886. {
  12887. $this->propagationStopped = true;
  12888. }
  12889. }
  12890. <?php
  12891. namespace Composer\EventDispatcher;
  12892. use Composer\DependencyResolver\PolicyInterface;
  12893. use Composer\DependencyResolver\Pool;
  12894. use Composer\DependencyResolver\Request;
  12895. use Composer\Installer\InstallerEvent;
  12896. use Composer\IO\IOInterface;
  12897. use Composer\Composer;
  12898. use Composer\DependencyResolver\Operation\OperationInterface;
  12899. use Composer\Repository\CompositeRepository;
  12900. use Composer\Script;
  12901. use Composer\Installer\PackageEvent;
  12902. use Composer\Installer\BinaryInstaller;
  12903. use Composer\Util\ProcessExecutor;
  12904. use Composer\Script\Event as ScriptEvent;
  12905. use Symfony\Component\Process\PhpExecutableFinder;
  12906. class EventDispatcher
  12907. {
  12908. protected $composer;
  12909. protected $io;
  12910. protected $loader;
  12911. protected $process;
  12912. protected $listeners;
  12913. private $eventStack;
  12914. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12915. {
  12916. $this->composer = $composer;
  12917. $this->io = $io;
  12918. $this->process = $process ?: new ProcessExecutor($io);
  12919. $this->eventStack = array();
  12920. }
  12921. public function dispatch($eventName, Event $event = null)
  12922. {
  12923. if (null === $event) {
  12924. $event = new Event($eventName);
  12925. }
  12926. return $this->doDispatch($event);
  12927. }
  12928. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12929. {
  12930. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12931. }
  12932. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12933. {
  12934. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12935. }
  12936. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12937. {
  12938. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12939. }
  12940. protected function doDispatch(Event $event)
  12941. {
  12942. $listeners = $this->getListeners($event);
  12943. $this->pushEvent($event);
  12944. $return = 0;
  12945. foreach ($listeners as $callable) {
  12946. $this->ensureBinDirIsInPath();
  12947. if (!is_string($callable)) {
  12948. if (!is_callable($callable)) {
  12949. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12950. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12951. }
  12952. $event = $this->checkListenerExpectedEvent($callable, $event);
  12953. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12954. } elseif ($this->isComposerScript($callable)) {
  12955. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12956. $script = explode(' ', substr($callable, 1));
  12957. $scriptName = $script[0];
  12958. unset($script[0]);
  12959. $args = array_merge($script, $event->getArguments());
  12960. $flags = $event->getFlags();
  12961. if (substr($callable, 0, 10) === '@composer ') {
  12962. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12963. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12964. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12965. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12966. }
  12967. } else {
  12968. if (!$this->getListeners(new Event($scriptName))) {
  12969. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12970. }
  12971. try {
  12972. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12973. $scriptEvent->setOriginatingEvent($event);
  12974. $return = $this->dispatch($scriptName, $scriptEvent);
  12975. } catch (ScriptExecutionException $e) {
  12976. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12977. throw $e;
  12978. }
  12979. }
  12980. } elseif ($this->isPhpScript($callable)) {
  12981. $className = substr($callable, 0, strpos($callable, '::'));
  12982. $methodName = substr($callable, strpos($callable, '::') + 2);
  12983. if (!class_exists($className)) {
  12984. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12985. continue;
  12986. }
  12987. if (!is_callable($callable)) {
  12988. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12989. continue;
  12990. }
  12991. try {
  12992. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12993. } catch (\Exception $e) {
  12994. $message = "Script %s handling the %s event terminated with an exception";
  12995. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12996. throw $e;
  12997. }
  12998. } else {
  12999. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  13000. $exec = $callable . ($args === '' ? '' : ' '.$args);
  13001. if ($this->io->isVerbose()) {
  13002. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  13003. } else {
  13004. $this->io->writeError(sprintf('> %s', $exec));
  13005. }
  13006. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  13007. if ($possibleLocalBinaries) {
  13008. foreach ($possibleLocalBinaries as $localExec) {
  13009. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  13010. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  13011. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  13012. break;
  13013. }
  13014. }
  13015. }
  13016. if (substr($exec, 0, 8) === '@putenv ') {
  13017. putenv(substr($exec, 8));
  13018. continue;
  13019. } elseif (substr($exec, 0, 5) === '@php ') {
  13020. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  13021. } else {
  13022. $finder = new PhpExecutableFinder();
  13023. $phpPath = $finder->find(false);
  13024. if ($phpPath) {
  13025. $_SERVER['PHP_BINARY'] = $phpPath;
  13026. putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']);
  13027. }
  13028. }
  13029. if (substr($exec, 0, 9) === 'composer ') {
  13030. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($exec, 8);
  13031. }
  13032. if (0 !== ($exitCode = $this->process->execute($exec))) {
  13033. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  13034. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  13035. }
  13036. }
  13037. if ($event->isPropagationStopped()) {
  13038. break;
  13039. }
  13040. }
  13041. $this->popEvent();
  13042. return $return;
  13043. }
  13044. protected function getPhpExecCommand()
  13045. {
  13046. $finder = new PhpExecutableFinder();
  13047. $phpPath = $finder->find(false);
  13048. if (!$phpPath) {
  13049. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  13050. }
  13051. $phpArgs = $finder->findArguments();
  13052. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  13053. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  13054. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  13055. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  13056. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  13057. }
  13058. protected function executeEventPhpScript($className, $methodName, Event $event)
  13059. {
  13060. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  13061. if ($this->io->isVerbose()) {
  13062. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  13063. } else {
  13064. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  13065. }
  13066. return $className::$methodName($event);
  13067. }
  13068. protected function checkListenerExpectedEvent($target, Event $event)
  13069. {
  13070. if (in_array($event->getName(), array(
  13071. 'init',
  13072. 'command',
  13073. 'pre-file-download',
  13074. ), true)) {
  13075. return $event;
  13076. }
  13077. try {
  13078. $reflected = new \ReflectionParameter($target, 0);
  13079. } catch (\Exception $e) {
  13080. return $event;
  13081. }
  13082. $expected = null;
  13083. $isClass = false;
  13084. if (\PHP_VERSION_ID >= 70000) {
  13085. $reflectionType = $reflected->getType();
  13086. if ($reflectionType) {
  13087. $expected = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  13088. $isClass = !$reflectionType->isBuiltin();
  13089. }
  13090. } else {
  13091. $expected = $reflected->getClass() ? $reflected->getClass()->getName() : null;
  13092. $isClass = null !== $expected;
  13093. }
  13094. if (!$isClass) {
  13095. return $event;
  13096. }
  13097. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  13098. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13099. $event = new \Composer\Script\CommandEvent(
  13100. $event->getName(),
  13101. $event->getComposer(),
  13102. $event->getIO(),
  13103. $event->isDevMode(),
  13104. $event->getArguments()
  13105. );
  13106. }
  13107. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  13108. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13109. $event = new \Composer\Script\PackageEvent(
  13110. $event->getName(),
  13111. $event->getComposer(),
  13112. $event->getIO(),
  13113. $event->isDevMode(),
  13114. $event->getPolicy(),
  13115. $event->getPool(),
  13116. $event->getInstalledRepo(),
  13117. $event->getRequest(),
  13118. $event->getOperations(),
  13119. $event->getOperation()
  13120. );
  13121. }
  13122. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  13123. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13124. $event = new \Composer\Script\Event(
  13125. $event->getName(),
  13126. $event->getComposer(),
  13127. $event->getIO(),
  13128. $event->isDevMode(),
  13129. $event->getArguments(),
  13130. $event->getFlags()
  13131. );
  13132. }
  13133. return $event;
  13134. }
  13135. private function serializeCallback($cb)
  13136. {
  13137. if (is_array($cb) && count($cb) === 2) {
  13138. if (is_object($cb[0])) {
  13139. $cb[0] = get_class($cb[0]);
  13140. }
  13141. if (is_string($cb[0]) && is_string($cb[1])) {
  13142. $cb = implode('::', $cb);
  13143. }
  13144. }
  13145. if (is_string($cb)) {
  13146. return $cb;
  13147. }
  13148. return var_export($cb, true);
  13149. }
  13150. public function addListener($eventName, $listener, $priority = 0)
  13151. {
  13152. $this->listeners[$eventName][$priority][] = $listener;
  13153. }
  13154. public function addSubscriber(EventSubscriberInterface $subscriber)
  13155. {
  13156. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  13157. if (is_string($params)) {
  13158. $this->addListener($eventName, array($subscriber, $params));
  13159. } elseif (is_string($params[0])) {
  13160. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  13161. } else {
  13162. foreach ($params as $listener) {
  13163. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  13164. }
  13165. }
  13166. }
  13167. }
  13168. protected function getListeners(Event $event)
  13169. {
  13170. $scriptListeners = $this->getScriptListeners($event);
  13171. if (!isset($this->listeners[$event->getName()][0])) {
  13172. $this->listeners[$event->getName()][0] = array();
  13173. }
  13174. krsort($this->listeners[$event->getName()]);
  13175. $listeners = $this->listeners;
  13176. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  13177. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  13178. }
  13179. public function hasEventListeners(Event $event)
  13180. {
  13181. $listeners = $this->getListeners($event);
  13182. return count($listeners) > 0;
  13183. }
  13184. protected function getScriptListeners(Event $event)
  13185. {
  13186. $package = $this->composer->getPackage();
  13187. $scripts = $package->getScripts();
  13188. if (empty($scripts[$event->getName()])) {
  13189. return array();
  13190. }
  13191. if ($this->loader) {
  13192. $this->loader->unregister();
  13193. }
  13194. $generator = $this->composer->getAutoloadGenerator();
  13195. if ($event instanceof ScriptEvent) {
  13196. $generator->setDevMode($event->isDevMode());
  13197. }
  13198. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  13199. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  13200. $map = $generator->parseAutoloads($packageMap, $package);
  13201. $this->loader = $generator->createLoader($map);
  13202. $this->loader->register();
  13203. return $scripts[$event->getName()];
  13204. }
  13205. protected function isPhpScript($callable)
  13206. {
  13207. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  13208. }
  13209. protected function isComposerScript($callable)
  13210. {
  13211. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5) && '@putenv ' !== substr($callable, 0, 8);
  13212. }
  13213. protected function pushEvent(Event $event)
  13214. {
  13215. $eventName = $event->getName();
  13216. if (in_array($eventName, $this->eventStack)) {
  13217. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  13218. }
  13219. return array_push($this->eventStack, $eventName);
  13220. }
  13221. protected function popEvent()
  13222. {
  13223. return array_pop($this->eventStack);
  13224. }
  13225. private function ensureBinDirIsInPath()
  13226. {
  13227. $pathStr = 'PATH';
  13228. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  13229. $pathStr = 'Path';
  13230. }
  13231. $binDir = $this->composer->getConfig()->get('bin-dir');
  13232. if (is_dir($binDir)) {
  13233. $binDir = realpath($binDir);
  13234. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  13235. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  13236. putenv($pathStr.'='.$_SERVER[$pathStr]);
  13237. }
  13238. }
  13239. }
  13240. }
  13241. <?php
  13242. namespace Composer\EventDispatcher;
  13243. interface EventSubscriberInterface
  13244. {
  13245. public static function getSubscribedEvents();
  13246. }
  13247. <?php
  13248. namespace Composer\EventDispatcher;
  13249. class ScriptExecutionException extends \RuntimeException
  13250. {
  13251. }
  13252. <?php
  13253. namespace Composer\Exception;
  13254. class NoSslException extends \RuntimeException
  13255. {
  13256. }
  13257. <?php
  13258. namespace Composer;
  13259. use Composer\Config\JsonConfigSource;
  13260. use Composer\Json\JsonFile;
  13261. use Composer\IO\IOInterface;
  13262. use Composer\Package\Archiver;
  13263. use Composer\Package\Version\VersionGuesser;
  13264. use Composer\Repository\RepositoryManager;
  13265. use Composer\Repository\RepositoryFactory;
  13266. use Composer\Repository\WritableRepositoryInterface;
  13267. use Composer\Util\Filesystem;
  13268. use Composer\Util\Platform;
  13269. use Composer\Util\ProcessExecutor;
  13270. use Composer\Util\RemoteFilesystem;
  13271. use Composer\Util\Silencer;
  13272. use Composer\Plugin\PluginEvents;
  13273. use Composer\EventDispatcher\Event;
  13274. use Seld\JsonLint\DuplicateKeyException;
  13275. use Symfony\Component\Console\Formatter\OutputFormatter;
  13276. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  13277. use Symfony\Component\Console\Output\ConsoleOutput;
  13278. use Composer\EventDispatcher\EventDispatcher;
  13279. use Composer\Autoload\AutoloadGenerator;
  13280. use Composer\Package\Version\VersionParser;
  13281. use Composer\Downloader\TransportException;
  13282. use Seld\JsonLint\JsonParser;
  13283. class Factory
  13284. {
  13285. protected static function getHomeDir()
  13286. {
  13287. $home = getenv('COMPOSER_HOME');
  13288. if ($home) {
  13289. return $home;
  13290. }
  13291. if (Platform::isWindows()) {
  13292. if (!getenv('APPDATA')) {
  13293. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13294. }
  13295. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  13296. }
  13297. $userDir = self::getUserDir();
  13298. if (is_dir($userDir . '/.composer')) {
  13299. return $userDir . '/.composer';
  13300. }
  13301. if (self::useXdg()) {
  13302. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  13303. return $xdgConfig . '/composer';
  13304. }
  13305. return $userDir . '/.composer';
  13306. }
  13307. protected static function getCacheDir($home)
  13308. {
  13309. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  13310. if ($cacheDir) {
  13311. return $cacheDir;
  13312. }
  13313. $homeEnv = getenv('COMPOSER_HOME');
  13314. if ($homeEnv) {
  13315. return $homeEnv . '/cache';
  13316. }
  13317. if (Platform::isWindows()) {
  13318. if ($cacheDir = getenv('LOCALAPPDATA')) {
  13319. $cacheDir .= '/Composer';
  13320. } else {
  13321. $cacheDir = $home . '/cache';
  13322. }
  13323. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  13324. }
  13325. $userDir = self::getUserDir();
  13326. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  13327. return $home . '/cache';
  13328. }
  13329. if (self::useXdg()) {
  13330. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  13331. return $xdgCache . '/composer';
  13332. }
  13333. return $home . '/cache';
  13334. }
  13335. protected static function getDataDir($home)
  13336. {
  13337. $homeEnv = getenv('COMPOSER_HOME');
  13338. if ($homeEnv) {
  13339. return $homeEnv;
  13340. }
  13341. if (Platform::isWindows()) {
  13342. return strtr($home, '\\', '/');
  13343. }
  13344. $userDir = self::getUserDir();
  13345. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  13346. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  13347. return $xdgData . '/composer';
  13348. }
  13349. return $home;
  13350. }
  13351. public static function createConfig(IOInterface $io = null, $cwd = null)
  13352. {
  13353. $cwd = $cwd ?: getcwd();
  13354. $config = new Config(true, $cwd);
  13355. $home = self::getHomeDir();
  13356. $config->merge(array('config' => array(
  13357. 'home' => $home,
  13358. 'cache-dir' => self::getCacheDir($home),
  13359. 'data-dir' => self::getDataDir($home),
  13360. )));
  13361. $file = new JsonFile($config->get('home').'/config.json');
  13362. if ($file->exists()) {
  13363. if ($io && $io->isDebug()) {
  13364. $io->writeError('Loading config file ' . $file->getPath());
  13365. }
  13366. $config->merge($file->read());
  13367. }
  13368. $config->setConfigSource(new JsonConfigSource($file));
  13369. $htaccessProtect = (bool) $config->get('htaccess-protect');
  13370. if ($htaccessProtect) {
  13371. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  13372. foreach ($dirs as $dir) {
  13373. if (!file_exists($dir . '/.htaccess')) {
  13374. if (!is_dir($dir)) {
  13375. Silencer::call('mkdir', $dir, 0777, true);
  13376. }
  13377. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  13378. }
  13379. }
  13380. }
  13381. $file = new JsonFile($config->get('home').'/auth.json');
  13382. if ($file->exists()) {
  13383. if ($io && $io->isDebug()) {
  13384. $io->writeError('Loading config file ' . $file->getPath());
  13385. }
  13386. $config->merge(array('config' => $file->read()));
  13387. }
  13388. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  13389. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  13390. $authData = json_decode($composerAuthEnv, true);
  13391. if (null === $authData) {
  13392. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  13393. }
  13394. if ($io && $io->isDebug()) {
  13395. $io->writeError('Loading auth config from COMPOSER_AUTH');
  13396. }
  13397. $config->merge(array('config' => $authData));
  13398. }
  13399. return $config;
  13400. }
  13401. public static function getComposerFile()
  13402. {
  13403. return trim(getenv('COMPOSER')) ?: './composer.json';
  13404. }
  13405. public static function createAdditionalStyles()
  13406. {
  13407. return array(
  13408. 'highlight' => new OutputFormatterStyle('red'),
  13409. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  13410. );
  13411. }
  13412. public static function createOutput()
  13413. {
  13414. $styles = self::createAdditionalStyles();
  13415. $formatter = new OutputFormatter(false, $styles);
  13416. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  13417. }
  13418. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  13419. {
  13420. return RepositoryFactory::defaultRepos($io, $config, $rm);
  13421. }
  13422. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  13423. {
  13424. $cwd = $cwd ?: getcwd();
  13425. if (null === $localConfig) {
  13426. $localConfig = static::getComposerFile();
  13427. }
  13428. if (is_string($localConfig)) {
  13429. $composerFile = $localConfig;
  13430. $file = new JsonFile($localConfig, null, $io);
  13431. if (!$file->exists()) {
  13432. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  13433. $message = 'Composer could not find a composer.json file in '.$cwd;
  13434. } else {
  13435. $message = 'Composer could not find the config file: '.$localConfig;
  13436. }
  13437. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  13438. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  13439. }
  13440. $file->validateSchema(JsonFile::LAX_SCHEMA);
  13441. $jsonParser = new JsonParser;
  13442. try {
  13443. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  13444. } catch (DuplicateKeyException $e) {
  13445. $details = $e->getDetails();
  13446. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  13447. }
  13448. $localConfig = $file->read();
  13449. }
  13450. $config = static::createConfig($io, $cwd);
  13451. $config->merge($localConfig);
  13452. if (isset($composerFile)) {
  13453. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  13454. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  13455. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  13456. if ($localAuthFile->exists()) {
  13457. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  13458. $config->merge(array('config' => $localAuthFile->read()));
  13459. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  13460. }
  13461. }
  13462. $vendorDir = $config->get('vendor-dir');
  13463. $composer = new Composer();
  13464. $composer->setConfig($config);
  13465. if ($fullLoad) {
  13466. $io->loadConfiguration($config);
  13467. }
  13468. $rfs = self::createRemoteFilesystem($io, $config);
  13469. $dispatcher = new EventDispatcher($composer, $io);
  13470. $composer->setEventDispatcher($dispatcher);
  13471. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  13472. $composer->setRepositoryManager($rm);
  13473. $this->addLocalRepository($io, $rm, $vendorDir);
  13474. if (!$fullLoad && !isset($localConfig['version'])) {
  13475. $localConfig['version'] = '1.0.0';
  13476. }
  13477. $parser = new VersionParser;
  13478. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  13479. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  13480. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  13481. $composer->setPackage($package);
  13482. $im = $this->createInstallationManager();
  13483. $composer->setInstallationManager($im);
  13484. if ($fullLoad) {
  13485. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  13486. $composer->setDownloadManager($dm);
  13487. $generator = new AutoloadGenerator($dispatcher, $io);
  13488. $composer->setAutoloadGenerator($generator);
  13489. $am = $this->createArchiveManager($config, $dm);
  13490. $composer->setArchiveManager($am);
  13491. }
  13492. $this->createDefaultInstallers($im, $composer, $io);
  13493. if ($fullLoad) {
  13494. $globalComposer = null;
  13495. if (realpath($config->get('home')) !== $cwd) {
  13496. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  13497. }
  13498. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  13499. $composer->setPluginManager($pm);
  13500. $pm->loadInstalledPlugins();
  13501. }
  13502. if ($fullLoad && isset($composerFile)) {
  13503. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  13504. ? substr($composerFile, 0, -4).'lock'
  13505. : $composerFile . '.lock';
  13506. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  13507. $composer->setLocker($locker);
  13508. }
  13509. if ($fullLoad) {
  13510. $initEvent = new Event(PluginEvents::INIT);
  13511. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  13512. if ($rm->getLocalRepository()) {
  13513. $this->purgePackages($rm->getLocalRepository(), $im);
  13514. }
  13515. }
  13516. return $composer;
  13517. }
  13518. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  13519. {
  13520. $factory = new static();
  13521. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  13522. }
  13523. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  13524. {
  13525. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  13526. }
  13527. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  13528. {
  13529. $composer = null;
  13530. try {
  13531. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  13532. } catch (\Exception $e) {
  13533. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  13534. }
  13535. return $composer;
  13536. }
  13537. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  13538. {
  13539. $cache = null;
  13540. if ($config->get('cache-files-ttl') > 0) {
  13541. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  13542. }
  13543. $dm = new Downloader\DownloadManager($io);
  13544. switch ($preferred = $config->get('preferred-install')) {
  13545. case 'dist':
  13546. $dm->setPreferDist(true);
  13547. break;
  13548. case 'source':
  13549. $dm->setPreferSource(true);
  13550. break;
  13551. case 'auto':
  13552. default:
  13553. break;
  13554. }
  13555. if (is_array($preferred)) {
  13556. $dm->setPreferences($preferred);
  13557. }
  13558. $executor = new ProcessExecutor($io);
  13559. $fs = new Filesystem($executor);
  13560. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  13561. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  13562. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  13563. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  13564. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  13565. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13566. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13567. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13568. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13569. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13570. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13571. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13572. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13573. return $dm;
  13574. }
  13575. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  13576. {
  13577. if (null === $dm) {
  13578. $io = new IO\NullIO();
  13579. $io->loadConfiguration($config);
  13580. $dm = $this->createDownloadManager($io, $config);
  13581. }
  13582. $am = new Archiver\ArchiveManager($dm);
  13583. $am->addArchiver(new Archiver\ZipArchiver);
  13584. $am->addArchiver(new Archiver\PharArchiver);
  13585. return $am;
  13586. }
  13587. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  13588. {
  13589. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  13590. }
  13591. protected function createInstallationManager()
  13592. {
  13593. return new Installer\InstallationManager();
  13594. }
  13595. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  13596. {
  13597. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  13598. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  13599. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  13600. $im->addInstaller(new Installer\MetapackageInstaller($io));
  13601. }
  13602. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  13603. {
  13604. foreach ($repo->getPackages() as $package) {
  13605. if (!$im->isPackageInstalled($repo, $package)) {
  13606. $repo->removePackage($package);
  13607. }
  13608. }
  13609. }
  13610. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13611. {
  13612. $factory = new static();
  13613. return $factory->createComposer($io, $config, $disablePlugins);
  13614. }
  13615. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13616. {
  13617. static $warned = false;
  13618. $disableTls = false;
  13619. if ($config && $config->get('disable-tls') === true) {
  13620. if (!$warned) {
  13621. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13622. }
  13623. $warned = true;
  13624. $disableTls = true;
  13625. } elseif (!extension_loaded('openssl')) {
  13626. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13627. . '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.');
  13628. }
  13629. $remoteFilesystemOptions = array();
  13630. if ($disableTls === false) {
  13631. if ($config && $config->get('cafile')) {
  13632. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13633. }
  13634. if ($config && $config->get('capath')) {
  13635. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13636. }
  13637. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13638. }
  13639. try {
  13640. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13641. } catch (TransportException $e) {
  13642. if (false !== strpos($e->getMessage(), 'cafile')) {
  13643. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13644. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13645. if (PHP_VERSION_ID < 50600) {
  13646. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13647. }
  13648. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13649. }
  13650. throw $e;
  13651. }
  13652. return $remoteFilesystem;
  13653. }
  13654. private static function useXdg()
  13655. {
  13656. foreach (array_keys($_SERVER) as $key) {
  13657. if (substr($key, 0, 4) === 'XDG_') {
  13658. return true;
  13659. }
  13660. }
  13661. return false;
  13662. }
  13663. private static function getUserDir()
  13664. {
  13665. $home = getenv('HOME');
  13666. if (!$home) {
  13667. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13668. }
  13669. return rtrim(strtr($home, '\\', '/'), '/');
  13670. }
  13671. }
  13672. <?php
  13673. namespace Composer\IO;
  13674. use Composer\Config;
  13675. use Composer\Util\ProcessExecutor;
  13676. use Psr\Log\LoggerInterface;
  13677. use Psr\Log\LogLevel;
  13678. abstract class BaseIO implements IOInterface, LoggerInterface
  13679. {
  13680. protected $authentications = array();
  13681. public function getAuthentications()
  13682. {
  13683. return $this->authentications;
  13684. }
  13685. public function resetAuthentications()
  13686. {
  13687. $this->authentications = array();
  13688. }
  13689. public function hasAuthentication($repositoryName)
  13690. {
  13691. return isset($this->authentications[$repositoryName]);
  13692. }
  13693. public function getAuthentication($repositoryName)
  13694. {
  13695. if (isset($this->authentications[$repositoryName])) {
  13696. return $this->authentications[$repositoryName];
  13697. }
  13698. return array('username' => null, 'password' => null);
  13699. }
  13700. public function setAuthentication($repositoryName, $username, $password = null)
  13701. {
  13702. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13703. }
  13704. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13705. {
  13706. $this->write($messages, $newline, $verbosity);
  13707. }
  13708. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13709. {
  13710. $this->writeError($messages, $newline, $verbosity);
  13711. }
  13712. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13713. {
  13714. if ($this->hasAuthentication($repositoryName)) {
  13715. $auth = $this->getAuthentication($repositoryName);
  13716. if ($auth['username'] === $username && $auth['password'] === $password) {
  13717. return;
  13718. }
  13719. $this->writeError(
  13720. sprintf(
  13721. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13722. $repositoryName
  13723. )
  13724. );
  13725. }
  13726. $this->setAuthentication($repositoryName, $username, $password);
  13727. }
  13728. public function loadConfiguration(Config $config)
  13729. {
  13730. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13731. $githubOauth = $config->get('github-oauth') ?: array();
  13732. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13733. $gitlabToken = $config->get('gitlab-token') ?: array();
  13734. $httpBasic = $config->get('http-basic') ?: array();
  13735. $bearerToken = $config->get('bearer') ?: array();
  13736. foreach ($bitbucketOauth as $domain => $cred) {
  13737. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13738. }
  13739. foreach ($githubOauth as $domain => $token) {
  13740. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13741. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13742. }
  13743. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13744. }
  13745. foreach ($gitlabOauth as $domain => $token) {
  13746. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13747. }
  13748. foreach ($gitlabToken as $domain => $token) {
  13749. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13750. }
  13751. foreach ($httpBasic as $domain => $cred) {
  13752. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13753. }
  13754. foreach ($bearerToken as $domain => $token) {
  13755. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  13756. }
  13757. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13758. }
  13759. public function emergency($message, array $context = array())
  13760. {
  13761. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13762. }
  13763. public function alert($message, array $context = array())
  13764. {
  13765. return $this->log(LogLevel::ALERT, $message, $context);
  13766. }
  13767. public function critical($message, array $context = array())
  13768. {
  13769. return $this->log(LogLevel::CRITICAL, $message, $context);
  13770. }
  13771. public function error($message, array $context = array())
  13772. {
  13773. return $this->log(LogLevel::ERROR, $message, $context);
  13774. }
  13775. public function warning($message, array $context = array())
  13776. {
  13777. return $this->log(LogLevel::WARNING, $message, $context);
  13778. }
  13779. public function notice($message, array $context = array())
  13780. {
  13781. return $this->log(LogLevel::NOTICE, $message, $context);
  13782. }
  13783. public function info($message, array $context = array())
  13784. {
  13785. return $this->log(LogLevel::INFO, $message, $context);
  13786. }
  13787. public function debug($message, array $context = array())
  13788. {
  13789. return $this->log(LogLevel::DEBUG, $message, $context);
  13790. }
  13791. public function log($level, $message, array $context = array())
  13792. {
  13793. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13794. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13795. } elseif ($level === LogLevel::WARNING) {
  13796. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13797. } elseif ($level === LogLevel::NOTICE) {
  13798. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13799. } elseif ($level === LogLevel::INFO) {
  13800. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13801. } else {
  13802. $this->writeError($message, true, self::DEBUG);
  13803. }
  13804. }
  13805. }
  13806. <?php
  13807. namespace Composer\IO;
  13808. use Symfony\Component\Console\Helper\QuestionHelper;
  13809. use Symfony\Component\Console\Output\StreamOutput;
  13810. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13811. use Symfony\Component\Console\Input\StreamableInputInterface;
  13812. use Symfony\Component\Console\Input\StringInput;
  13813. use Symfony\Component\Console\Helper\HelperSet;
  13814. class BufferIO extends ConsoleIO
  13815. {
  13816. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13817. {
  13818. $input = new StringInput($input);
  13819. $input->setInteractive(false);
  13820. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13821. parent::__construct($input, $output, new HelperSet(array(
  13822. new QuestionHelper(),
  13823. )));
  13824. }
  13825. public function getOutput()
  13826. {
  13827. fseek($this->output->getStream(), 0);
  13828. $output = stream_get_contents($this->output->getStream());
  13829. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13830. $pre = strip_tags($matches[1]);
  13831. if (strlen($pre) === strlen($matches[2])) {
  13832. return '';
  13833. }
  13834. return rtrim($matches[1])."\n";
  13835. }, $output);
  13836. return $output;
  13837. }
  13838. public function setUserInputs(array $inputs)
  13839. {
  13840. if (!$this->input instanceof StreamableInputInterface) {
  13841. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13842. }
  13843. $this->input->setStream($this->createStream($inputs));
  13844. $this->input->setInteractive(true);
  13845. }
  13846. private function createStream(array $inputs)
  13847. {
  13848. $stream = fopen('php://memory', 'r+', false);
  13849. foreach ($inputs as $input) {
  13850. fwrite($stream, $input.PHP_EOL);
  13851. }
  13852. rewind($stream);
  13853. return $stream;
  13854. }
  13855. }
  13856. <?php
  13857. namespace Composer\IO;
  13858. use Composer\Question\StrictConfirmationQuestion;
  13859. use Symfony\Component\Console\Helper\HelperSet;
  13860. use Symfony\Component\Console\Input\InputInterface;
  13861. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13862. use Symfony\Component\Console\Output\OutputInterface;
  13863. use Symfony\Component\Console\Question\ChoiceQuestion;
  13864. use Symfony\Component\Console\Question\Question;
  13865. class ConsoleIO extends BaseIO
  13866. {
  13867. protected $input;
  13868. protected $output;
  13869. protected $helperSet;
  13870. protected $lastMessage;
  13871. protected $lastMessageErr;
  13872. private $startTime;
  13873. private $verbosityMap;
  13874. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13875. {
  13876. $this->input = $input;
  13877. $this->output = $output;
  13878. $this->helperSet = $helperSet;
  13879. $this->verbosityMap = array(
  13880. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13881. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13882. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13883. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13884. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13885. );
  13886. }
  13887. public function enableDebugging($startTime)
  13888. {
  13889. $this->startTime = $startTime;
  13890. }
  13891. public function isInteractive()
  13892. {
  13893. return $this->input->isInteractive();
  13894. }
  13895. public function isDecorated()
  13896. {
  13897. return $this->output->isDecorated();
  13898. }
  13899. public function isVerbose()
  13900. {
  13901. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13902. }
  13903. public function isVeryVerbose()
  13904. {
  13905. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13906. }
  13907. public function isDebug()
  13908. {
  13909. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13910. }
  13911. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13912. {
  13913. $this->doWrite($messages, $newline, false, $verbosity);
  13914. }
  13915. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13916. {
  13917. $this->doWrite($messages, $newline, true, $verbosity);
  13918. }
  13919. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13920. {
  13921. $this->doWrite($messages, $newline, false, $verbosity, true);
  13922. }
  13923. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13924. {
  13925. $this->doWrite($messages, $newline, true, $verbosity, true);
  13926. }
  13927. private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false)
  13928. {
  13929. $sfVerbosity = $this->verbosityMap[$verbosity];
  13930. if ($sfVerbosity > $this->output->getVerbosity()) {
  13931. return;
  13932. }
  13933. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13934. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13935. }
  13936. if ($raw) {
  13937. if ($sfVerbosity === OutputInterface::OUTPUT_NORMAL) {
  13938. $sfVerbosity = OutputInterface::OUTPUT_RAW;
  13939. } else {
  13940. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  13941. }
  13942. }
  13943. if (null !== $this->startTime) {
  13944. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13945. $timeSpent = microtime(true) - $this->startTime;
  13946. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13947. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13948. }, (array) $messages);
  13949. }
  13950. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13951. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13952. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13953. return;
  13954. }
  13955. $this->output->write($messages, $newline, $sfVerbosity);
  13956. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13957. }
  13958. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13959. {
  13960. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13961. }
  13962. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13963. {
  13964. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13965. }
  13966. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13967. {
  13968. $messages = implode($newline ? "\n" : '', (array) $messages);
  13969. if (!isset($size)) {
  13970. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13971. }
  13972. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13973. $this->doWrite($messages, false, $stderr, $verbosity);
  13974. $fill = $size - strlen(strip_tags($messages));
  13975. if ($fill > 0) {
  13976. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13977. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13978. }
  13979. if ($newline) {
  13980. $this->doWrite('', true, $stderr, $verbosity);
  13981. }
  13982. if ($stderr) {
  13983. $this->lastMessageErr = $messages;
  13984. } else {
  13985. $this->lastMessage = $messages;
  13986. }
  13987. }
  13988. public function ask($question, $default = null)
  13989. {
  13990. $helper = $this->helperSet->get('question');
  13991. $question = new Question($question, $default);
  13992. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13993. }
  13994. public function askConfirmation($question, $default = true)
  13995. {
  13996. $helper = $this->helperSet->get('question');
  13997. $question = new StrictConfirmationQuestion($question, $default);
  13998. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13999. }
  14000. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  14001. {
  14002. $helper = $this->helperSet->get('question');
  14003. $question = new Question($question, $default);
  14004. $question->setValidator($validator);
  14005. $question->setMaxAttempts($attempts);
  14006. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14007. }
  14008. public function askAndHideAnswer($question)
  14009. {
  14010. $helper = $this->helperSet->get('question');
  14011. $question = new Question($question);
  14012. $question->setHidden(true);
  14013. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14014. }
  14015. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14016. {
  14017. $helper = $this->helperSet->get('question');
  14018. $question = new ChoiceQuestion($question, $choices, $default);
  14019. $question->setMaxAttempts($attempts ?: null);
  14020. $question->setErrorMessage($errorMessage);
  14021. $question->setMultiselect($multiselect);
  14022. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  14023. if (!is_array($result)) {
  14024. return (string) array_search($result, $choices, true);
  14025. }
  14026. $results = array();
  14027. foreach ($choices as $index => $choice) {
  14028. if (in_array($choice, $result, true)) {
  14029. $results[] = (string) $index;
  14030. }
  14031. }
  14032. return $results;
  14033. }
  14034. private function getErrorOutput()
  14035. {
  14036. if ($this->output instanceof ConsoleOutputInterface) {
  14037. return $this->output->getErrorOutput();
  14038. }
  14039. return $this->output;
  14040. }
  14041. }
  14042. <?php
  14043. namespace Composer\IO;
  14044. use Composer\Config;
  14045. interface IOInterface
  14046. {
  14047. const QUIET = 1;
  14048. const NORMAL = 2;
  14049. const VERBOSE = 4;
  14050. const VERY_VERBOSE = 8;
  14051. const DEBUG = 16;
  14052. public function isInteractive();
  14053. public function isVerbose();
  14054. public function isVeryVerbose();
  14055. public function isDebug();
  14056. public function isDecorated();
  14057. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  14058. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  14059. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14060. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14061. public function ask($question, $default = null);
  14062. public function askConfirmation($question, $default = true);
  14063. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  14064. public function askAndHideAnswer($question);
  14065. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  14066. public function getAuthentications();
  14067. public function hasAuthentication($repositoryName);
  14068. public function getAuthentication($repositoryName);
  14069. public function setAuthentication($repositoryName, $username, $password = null);
  14070. public function loadConfiguration(Config $config);
  14071. }
  14072. <?php
  14073. namespace Composer\IO;
  14074. class NullIO extends BaseIO
  14075. {
  14076. public function isInteractive()
  14077. {
  14078. return false;
  14079. }
  14080. public function isVerbose()
  14081. {
  14082. return false;
  14083. }
  14084. public function isVeryVerbose()
  14085. {
  14086. return false;
  14087. }
  14088. public function isDebug()
  14089. {
  14090. return false;
  14091. }
  14092. public function isDecorated()
  14093. {
  14094. return false;
  14095. }
  14096. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  14097. {
  14098. }
  14099. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  14100. {
  14101. }
  14102. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14103. {
  14104. }
  14105. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14106. {
  14107. }
  14108. public function ask($question, $default = null)
  14109. {
  14110. return $default;
  14111. }
  14112. public function askConfirmation($question, $default = true)
  14113. {
  14114. return $default;
  14115. }
  14116. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  14117. {
  14118. return $default;
  14119. }
  14120. public function askAndHideAnswer($question)
  14121. {
  14122. return null;
  14123. }
  14124. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14125. {
  14126. return $default;
  14127. }
  14128. }
  14129. <?php
  14130. namespace Composer;
  14131. use Composer\Autoload\AutoloadGenerator;
  14132. use Composer\DependencyResolver\DefaultPolicy;
  14133. use Composer\DependencyResolver\Operation\UpdateOperation;
  14134. use Composer\DependencyResolver\Operation\InstallOperation;
  14135. use Composer\DependencyResolver\Operation\UninstallOperation;
  14136. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14137. use Composer\DependencyResolver\Operation\OperationInterface;
  14138. use Composer\DependencyResolver\PolicyInterface;
  14139. use Composer\DependencyResolver\Pool;
  14140. use Composer\DependencyResolver\Request;
  14141. use Composer\DependencyResolver\Rule;
  14142. use Composer\DependencyResolver\Solver;
  14143. use Composer\DependencyResolver\SolverProblemsException;
  14144. use Composer\Downloader\DownloadManager;
  14145. use Composer\EventDispatcher\EventDispatcher;
  14146. use Composer\Installer\InstallationManager;
  14147. use Composer\Installer\InstallerEvents;
  14148. use Composer\Installer\NoopInstaller;
  14149. use Composer\Installer\SuggestedPackagesReporter;
  14150. use Composer\IO\IOInterface;
  14151. use Composer\Package\AliasPackage;
  14152. use Composer\Package\BasePackage;
  14153. use Composer\Package\CompletePackage;
  14154. use Composer\Package\CompletePackageInterface;
  14155. use Composer\Package\Link;
  14156. use Composer\Package\Loader\ArrayLoader;
  14157. use Composer\Package\Dumper\ArrayDumper;
  14158. use Composer\Semver\Constraint\Constraint;
  14159. use Composer\Package\Locker;
  14160. use Composer\Package\PackageInterface;
  14161. use Composer\Package\RootPackageInterface;
  14162. use Composer\Repository\CompositeRepository;
  14163. use Composer\Repository\InstalledArrayRepository;
  14164. use Composer\Repository\PlatformRepository;
  14165. use Composer\Repository\RepositoryInterface;
  14166. use Composer\Repository\RepositoryManager;
  14167. use Composer\Repository\WritableRepositoryInterface;
  14168. use Composer\Script\ScriptEvents;
  14169. class Installer
  14170. {
  14171. protected $io;
  14172. protected $config;
  14173. protected $package;
  14174. protected $downloadManager;
  14175. protected $repositoryManager;
  14176. protected $locker;
  14177. protected $installationManager;
  14178. protected $eventDispatcher;
  14179. protected $autoloadGenerator;
  14180. protected $preferSource = false;
  14181. protected $preferDist = false;
  14182. protected $optimizeAutoloader = false;
  14183. protected $classMapAuthoritative = false;
  14184. protected $apcuAutoloader = false;
  14185. protected $devMode = false;
  14186. protected $dryRun = false;
  14187. protected $verbose = false;
  14188. protected $update = false;
  14189. protected $dumpAutoloader = true;
  14190. protected $runScripts = true;
  14191. protected $ignorePlatformReqs = false;
  14192. protected $preferStable = false;
  14193. protected $preferLowest = false;
  14194. protected $skipSuggest = false;
  14195. protected $writeLock;
  14196. protected $executeOperations = true;
  14197. protected $updateWhitelist = null;
  14198. protected $whitelistDependencies = false;
  14199. protected $whitelistAllDependencies = false;
  14200. protected $suggestedPackagesReporter;
  14201. protected $additionalInstalledRepository;
  14202. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  14203. {
  14204. $this->io = $io;
  14205. $this->config = $config;
  14206. $this->package = $package;
  14207. $this->downloadManager = $downloadManager;
  14208. $this->repositoryManager = $repositoryManager;
  14209. $this->locker = $locker;
  14210. $this->installationManager = $installationManager;
  14211. $this->eventDispatcher = $eventDispatcher;
  14212. $this->autoloadGenerator = $autoloadGenerator;
  14213. $this->writeLock = $config->get('lock');
  14214. }
  14215. public function run()
  14216. {
  14217. gc_collect_cycles();
  14218. gc_disable();
  14219. if (!$this->update && !$this->locker->isLocked()) {
  14220. $this->update = true;
  14221. }
  14222. if ($this->dryRun) {
  14223. $this->verbose = true;
  14224. $this->runScripts = false;
  14225. $this->executeOperations = false;
  14226. $this->writeLock = false;
  14227. $this->dumpAutoloader = false;
  14228. $this->installationManager->addInstaller(new NoopInstaller);
  14229. $this->mockLocalRepositories($this->repositoryManager);
  14230. }
  14231. if ($this->runScripts) {
  14232. $_SERVER['COMPOSER_DEV_MODE'] = $this->devMode ? '1' : '0';
  14233. putenv('COMPOSER_DEV_MODE='.$_SERVER['COMPOSER_DEV_MODE']);
  14234. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  14235. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14236. }
  14237. $this->downloadManager->setPreferSource($this->preferSource);
  14238. $this->downloadManager->setPreferDist($this->preferDist);
  14239. $localRepo = $this->repositoryManager->getLocalRepository();
  14240. if ($this->update) {
  14241. $platformOverrides = $this->config->get('platform') ?: array();
  14242. } else {
  14243. $platformOverrides = $this->locker->getPlatformOverrides();
  14244. }
  14245. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  14246. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14247. $aliases = $this->getRootAliases();
  14248. $this->aliasPlatformPackages($platformRepo, $aliases);
  14249. if (!$this->suggestedPackagesReporter) {
  14250. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  14251. }
  14252. try {
  14253. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  14254. if ($res !== 0) {
  14255. return $res;
  14256. }
  14257. } catch (\Exception $e) {
  14258. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14259. $this->installationManager->notifyInstalls($this->io);
  14260. }
  14261. throw $e;
  14262. }
  14263. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14264. $this->installationManager->notifyInstalls($this->io);
  14265. }
  14266. if ($this->devMode && !$this->skipSuggest) {
  14267. $this->suggestedPackagesReporter->output($installedRepo);
  14268. }
  14269. foreach ($localRepo->getPackages() as $package) {
  14270. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  14271. continue;
  14272. }
  14273. $replacement = is_string($package->getReplacementPackage())
  14274. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  14275. : 'No replacement was suggested';
  14276. $this->io->writeError(
  14277. sprintf(
  14278. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  14279. $package->getPrettyName(),
  14280. $replacement
  14281. )
  14282. );
  14283. }
  14284. if ($this->update && $this->writeLock) {
  14285. $localRepo->reload();
  14286. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  14287. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  14288. $updatedLock = $this->locker->setLockData(
  14289. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  14290. $devPackages,
  14291. $platformReqs,
  14292. $platformDevReqs,
  14293. $aliases,
  14294. $this->package->getMinimumStability(),
  14295. $this->package->getStabilityFlags(),
  14296. $this->preferStable || $this->package->getPreferStable(),
  14297. $this->preferLowest,
  14298. $this->config->get('platform') ?: array()
  14299. );
  14300. if ($updatedLock) {
  14301. $this->io->writeError('<info>Writing lock file</info>');
  14302. }
  14303. }
  14304. if ($this->dumpAutoloader) {
  14305. if ($this->optimizeAutoloader) {
  14306. $this->io->writeError('<info>Generating optimized autoload files</info>');
  14307. } else {
  14308. $this->io->writeError('<info>Generating autoload files</info>');
  14309. }
  14310. $this->autoloadGenerator->setDevMode($this->devMode);
  14311. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  14312. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  14313. $this->autoloadGenerator->setRunScripts($this->runScripts);
  14314. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  14315. }
  14316. if ($this->executeOperations) {
  14317. foreach ($localRepo->getPackages() as $package) {
  14318. $this->installationManager->ensureBinariesPresence($package);
  14319. }
  14320. }
  14321. $fundingCount = 0;
  14322. foreach ($localRepo->getPackages() as $package) {
  14323. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  14324. $fundingCount++;
  14325. }
  14326. }
  14327. if ($fundingCount) {
  14328. $this->io->writeError(array(
  14329. sprintf(
  14330. "<info>%d package%s you are using %s looking for funding.</info>",
  14331. $fundingCount,
  14332. 1 === $fundingCount ? '' : 's',
  14333. 1 === $fundingCount ? 'is' : 'are'
  14334. ),
  14335. '<info>Use the `composer fund` command to find out more!</info>',
  14336. ));
  14337. }
  14338. if ($this->runScripts) {
  14339. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  14340. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14341. }
  14342. if (!defined('HHVM_VERSION')) {
  14343. gc_enable();
  14344. }
  14345. return 0;
  14346. }
  14347. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  14348. {
  14349. $lockedRepository = null;
  14350. $repositories = null;
  14351. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  14352. try {
  14353. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  14354. } catch (\RuntimeException $e) {
  14355. if ($this->package->getDevRequires()) {
  14356. throw $e;
  14357. }
  14358. $lockedRepository = $this->locker->getLockedRepository();
  14359. }
  14360. }
  14361. $this->allowListUpdateDependencies(
  14362. $lockedRepository ?: $localRepo,
  14363. $this->package->getRequires(),
  14364. $this->package->getDevRequires()
  14365. );
  14366. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  14367. $policy = $this->createPolicy();
  14368. $pool = $this->createPool($this->update ? null : $lockedRepository);
  14369. $pool->addRepository($installedRepo, $aliases);
  14370. if ($this->update) {
  14371. $repositories = $this->repositoryManager->getRepositories();
  14372. foreach ($repositories as $repository) {
  14373. $pool->addRepository($repository, $aliases);
  14374. }
  14375. }
  14376. if ($lockedRepository) {
  14377. $pool->addRepository($lockedRepository, $aliases);
  14378. }
  14379. $request = $this->createRequest($this->package, $platformRepo);
  14380. if ($this->update) {
  14381. $removedUnstablePackages = array();
  14382. foreach ($localRepo->getPackages() as $package) {
  14383. if (
  14384. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  14385. && $this->installationManager->isPackageInstalled($localRepo, $package)
  14386. ) {
  14387. $removedUnstablePackages[$package->getName()] = true;
  14388. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  14389. }
  14390. }
  14391. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  14392. $request->updateAll();
  14393. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14394. foreach ($links as $link) {
  14395. $request->install($link->getTarget(), $link->getConstraint());
  14396. }
  14397. if ($this->updateWhitelist) {
  14398. $currentPackages = $this->getCurrentPackages($installedRepo);
  14399. $candidates = array();
  14400. foreach ($links as $link) {
  14401. $candidates[$link->getTarget()] = true;
  14402. $rootRequires[$link->getTarget()] = $link;
  14403. }
  14404. foreach ($currentPackages as $package) {
  14405. $candidates[$package->getName()] = true;
  14406. }
  14407. foreach ($candidates as $candidate => $dummy) {
  14408. foreach ($currentPackages as $curPackage) {
  14409. if ($curPackage->getName() === $candidate) {
  14410. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  14411. $constraint = new Constraint('=', $curPackage->getVersion());
  14412. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  14413. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  14414. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  14415. $request->install($curPackage->getName(), $constraint);
  14416. }
  14417. break;
  14418. }
  14419. }
  14420. }
  14421. }
  14422. } else {
  14423. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  14424. if (!$this->locker->isFresh()) {
  14425. $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);
  14426. }
  14427. foreach ($lockedRepository->getPackages() as $package) {
  14428. $version = $package->getVersion();
  14429. if (isset($aliases[$package->getName()][$version])) {
  14430. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  14431. }
  14432. $constraint = new Constraint('=', $version);
  14433. $constraint->setPrettyString($package->getPrettyVersion());
  14434. $request->install($package->getName(), $constraint);
  14435. }
  14436. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  14437. $request->install($link->getTarget(), $link->getConstraint());
  14438. }
  14439. }
  14440. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  14441. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  14442. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14443. try {
  14444. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  14445. $ruleSetSize = $solver->getRuleSetSize();
  14446. $solver = null;
  14447. } catch (SolverProblemsException $e) {
  14448. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  14449. $this->io->writeError($e->getMessage());
  14450. if ($this->update && !$this->devMode) {
  14451. $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);
  14452. }
  14453. return array(max(1, $e->getCode()), array());
  14454. }
  14455. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  14456. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  14457. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  14458. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  14459. if (!$operations) {
  14460. $this->io->writeError('Nothing to install or update');
  14461. }
  14462. $operations = $this->movePluginsToFront($operations);
  14463. $operations = $this->moveUninstallsToFront($operations);
  14464. if ($this->update) {
  14465. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  14466. if (!$this->devMode) {
  14467. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  14468. }
  14469. } else {
  14470. $devPackages = null;
  14471. }
  14472. if ($operations) {
  14473. $installs = $updates = $uninstalls = array();
  14474. foreach ($operations as $operation) {
  14475. if ($operation instanceof InstallOperation) {
  14476. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  14477. } elseif ($operation instanceof UpdateOperation) {
  14478. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  14479. } elseif ($operation instanceof UninstallOperation) {
  14480. $uninstalls[] = $operation->getPackage()->getPrettyName();
  14481. }
  14482. }
  14483. $this->io->writeError(sprintf(
  14484. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  14485. count($installs),
  14486. 1 === count($installs) ? '' : 's',
  14487. count($updates),
  14488. 1 === count($updates) ? '' : 's',
  14489. count($uninstalls),
  14490. 1 === count($uninstalls) ? '' : 's'
  14491. ));
  14492. if ($installs) {
  14493. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  14494. }
  14495. if ($updates) {
  14496. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  14497. }
  14498. if ($uninstalls) {
  14499. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  14500. }
  14501. }
  14502. foreach ($operations as $operation) {
  14503. $jobType = $operation->getJobType();
  14504. if ('install' === $jobType) {
  14505. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  14506. }
  14507. if ($this->update) {
  14508. $package = null;
  14509. if ('update' === $jobType) {
  14510. $package = $operation->getTargetPackage();
  14511. } elseif ('install' === $jobType) {
  14512. $package = $operation->getPackage();
  14513. }
  14514. if ($package && $package->isDev()) {
  14515. $references = $this->package->getReferences();
  14516. if (isset($references[$package->getName()])) {
  14517. $this->updateInstallReferences($package, $references[$package->getName()]);
  14518. }
  14519. }
  14520. if ('update' === $jobType) {
  14521. $targetPackage = $operation->getTargetPackage();
  14522. if ($targetPackage->isDev()) {
  14523. $initialPackage = $operation->getInitialPackage();
  14524. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  14525. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  14526. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  14527. ) {
  14528. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  14529. $this->io->writeError('', true, IOInterface::DEBUG);
  14530. continue;
  14531. }
  14532. }
  14533. }
  14534. }
  14535. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  14536. if (defined($event) && $this->runScripts) {
  14537. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14538. }
  14539. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  14540. $this->io->writeError(' - ' . $operation);
  14541. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  14542. $this->io->writeError(' - ' . $operation);
  14543. }
  14544. $this->installationManager->execute($localRepo, $operation);
  14545. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  14546. $reason = $operation->getReason();
  14547. if ($reason instanceof Rule) {
  14548. switch ($reason->getReason()) {
  14549. case Rule::RULE_JOB_INSTALL:
  14550. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  14551. $this->io->writeError('');
  14552. break;
  14553. case Rule::RULE_PACKAGE_REQUIRES:
  14554. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  14555. $this->io->writeError('');
  14556. break;
  14557. }
  14558. }
  14559. }
  14560. if ($this->executeOperations || $this->writeLock) {
  14561. $localRepo->write();
  14562. }
  14563. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  14564. if (defined($event) && $this->runScripts) {
  14565. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14566. }
  14567. }
  14568. if ($this->executeOperations) {
  14569. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  14570. $localRepo->write();
  14571. }
  14572. if ($operations) {
  14573. $vendorDir = $this->config->get('vendor-dir');
  14574. if (is_dir($vendorDir)) {
  14575. @touch($vendorDir);
  14576. }
  14577. }
  14578. return array(0, $devPackages);
  14579. }
  14580. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  14581. {
  14582. if (!$this->package->getDevRequires()) {
  14583. return array();
  14584. }
  14585. $tempLocalRepo = clone $localRepo;
  14586. foreach ($operations as $operation) {
  14587. switch ($operation->getJobType()) {
  14588. case 'install':
  14589. case 'markAliasInstalled':
  14590. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  14591. $tempLocalRepo->addPackage(clone $operation->getPackage());
  14592. }
  14593. break;
  14594. case 'uninstall':
  14595. case 'markAliasUninstalled':
  14596. $tempLocalRepo->removePackage($operation->getPackage());
  14597. break;
  14598. case 'update':
  14599. $tempLocalRepo->removePackage($operation->getInitialPackage());
  14600. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  14601. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  14602. }
  14603. break;
  14604. default:
  14605. throw new \LogicException('Unknown type: '.$operation->getJobType());
  14606. }
  14607. }
  14608. $localRepo = new InstalledArrayRepository(array());
  14609. $loader = new ArrayLoader(null, true);
  14610. $dumper = new ArrayDumper();
  14611. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  14612. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  14613. }
  14614. unset($tempLocalRepo, $loader, $dumper);
  14615. $policy = $this->createPolicy();
  14616. $pool = $this->createPool();
  14617. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14618. $pool->addRepository($installedRepo, $aliases);
  14619. $request = $this->createRequest($this->package, $platformRepo);
  14620. $request->updateAll();
  14621. foreach ($this->package->getRequires() as $link) {
  14622. $request->install($link->getTarget(), $link->getConstraint());
  14623. }
  14624. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  14625. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14626. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  14627. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  14628. $devPackages = array();
  14629. foreach ($ops as $op) {
  14630. if ($op->getJobType() === 'uninstall') {
  14631. $devPackages[] = $op->getPackage();
  14632. }
  14633. }
  14634. return $devPackages;
  14635. }
  14636. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  14637. {
  14638. $finalOps = array();
  14639. $packagesToSkip = array();
  14640. foreach ($devPackages as $pkg) {
  14641. $packagesToSkip[$pkg->getName()] = true;
  14642. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  14643. if ($installedDevPkg instanceof AliasPackage) {
  14644. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  14645. $installedDevPkg = $installedDevPkg->getAliasOf();
  14646. }
  14647. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  14648. }
  14649. }
  14650. foreach ($operations as $op) {
  14651. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  14652. if (isset($packagesToSkip[$package->getName()])) {
  14653. continue;
  14654. }
  14655. $finalOps[] = $op;
  14656. }
  14657. return $finalOps;
  14658. }
  14659. private function movePluginsToFront(array $operations)
  14660. {
  14661. $pluginsNoDeps = array();
  14662. $pluginsWithDeps = array();
  14663. $pluginRequires = array();
  14664. foreach (array_reverse($operations, true) as $idx => $op) {
  14665. if ($op instanceof InstallOperation) {
  14666. $package = $op->getPackage();
  14667. } elseif ($op instanceof UpdateOperation) {
  14668. $package = $op->getTargetPackage();
  14669. } else {
  14670. continue;
  14671. }
  14672. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14673. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14674. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14675. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14676. });
  14677. if ($isPlugin && !count($requires)) {
  14678. array_unshift($pluginsNoDeps, $op);
  14679. } else {
  14680. $pluginRequires = array_merge($pluginRequires, $requires);
  14681. array_unshift($pluginsWithDeps, $op);
  14682. }
  14683. unset($operations[$idx]);
  14684. }
  14685. }
  14686. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14687. }
  14688. private function moveUninstallsToFront(array $operations)
  14689. {
  14690. $uninstOps = array();
  14691. foreach ($operations as $idx => $op) {
  14692. if ($op instanceof UninstallOperation) {
  14693. $uninstOps[] = $op;
  14694. unset($operations[$idx]);
  14695. }
  14696. }
  14697. return array_merge($uninstOps, $operations);
  14698. }
  14699. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14700. {
  14701. $installedRootPackage = clone $this->package;
  14702. $installedRootPackage->setRequires(array());
  14703. $installedRootPackage->setDevRequires(array());
  14704. $repos = array(
  14705. $localRepo,
  14706. new InstalledArrayRepository(array($installedRootPackage)),
  14707. $platformRepo,
  14708. );
  14709. $installedRepo = new CompositeRepository($repos);
  14710. if ($this->additionalInstalledRepository) {
  14711. $installedRepo->addRepository($this->additionalInstalledRepository);
  14712. }
  14713. return $installedRepo;
  14714. }
  14715. private function createPool(RepositoryInterface $lockedRepository = null)
  14716. {
  14717. if ($this->update) {
  14718. $minimumStability = $this->package->getMinimumStability();
  14719. $stabilityFlags = $this->package->getStabilityFlags();
  14720. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14721. } else {
  14722. $minimumStability = $this->locker->getMinimumStability();
  14723. $stabilityFlags = $this->locker->getStabilityFlags();
  14724. $requires = array();
  14725. foreach ($lockedRepository->getPackages() as $package) {
  14726. $constraint = new Constraint('=', $package->getVersion());
  14727. $constraint->setPrettyString($package->getPrettyVersion());
  14728. $requires[$package->getName()] = $constraint;
  14729. }
  14730. }
  14731. $rootConstraints = array();
  14732. foreach ($requires as $req => $constraint) {
  14733. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14734. continue;
  14735. }
  14736. if ($constraint instanceof Link) {
  14737. $rootConstraints[$req] = $constraint->getConstraint();
  14738. } else {
  14739. $rootConstraints[$req] = $constraint;
  14740. }
  14741. }
  14742. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14743. }
  14744. private function createPolicy()
  14745. {
  14746. $preferStable = null;
  14747. $preferLowest = null;
  14748. if (!$this->update) {
  14749. $preferStable = $this->locker->getPreferStable();
  14750. $preferLowest = $this->locker->getPreferLowest();
  14751. }
  14752. if (null === $preferStable) {
  14753. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14754. }
  14755. if (null === $preferLowest) {
  14756. $preferLowest = $this->preferLowest;
  14757. }
  14758. return new DefaultPolicy($preferStable, $preferLowest);
  14759. }
  14760. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14761. {
  14762. $request = new Request();
  14763. $constraint = new Constraint('=', $rootPackage->getVersion());
  14764. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14765. $request->install($rootPackage->getName(), $constraint);
  14766. $fixedPackages = $platformRepo->getPackages();
  14767. if ($this->additionalInstalledRepository) {
  14768. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14769. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14770. }
  14771. $provided = $rootPackage->getProvides();
  14772. foreach ($fixedPackages as $package) {
  14773. $constraint = new Constraint('=', $package->getVersion());
  14774. $constraint->setPrettyString($package->getPrettyVersion());
  14775. if ($package->getRepository() !== $platformRepo
  14776. || !isset($provided[$package->getName()])
  14777. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14778. ) {
  14779. $request->fix($package->getName(), $constraint);
  14780. }
  14781. }
  14782. return $request;
  14783. }
  14784. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14785. {
  14786. if ($task === 'force-updates' && null === $operations) {
  14787. throw new \InvalidArgumentException('Missing operations argument');
  14788. }
  14789. if ($task === 'force-links') {
  14790. $operations = array();
  14791. }
  14792. if ($this->update && $this->updateWhitelist) {
  14793. $currentPackages = $this->getCurrentPackages($installedRepo);
  14794. }
  14795. foreach ($localRepo->getCanonicalPackages() as $package) {
  14796. if (!$package->isDev()) {
  14797. continue;
  14798. }
  14799. foreach ($operations as $operation) {
  14800. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14801. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14802. ) {
  14803. continue 2;
  14804. }
  14805. }
  14806. if ($this->update) {
  14807. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14808. foreach ($currentPackages as $curPackage) {
  14809. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14810. if ($task === 'force-links') {
  14811. $package->setRequires($curPackage->getRequires());
  14812. $package->setConflicts($curPackage->getConflicts());
  14813. $package->setProvides($curPackage->getProvides());
  14814. $package->setReplaces($curPackage->getReplaces());
  14815. } elseif ($task === 'force-updates') {
  14816. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14817. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14818. ) {
  14819. $operations[] = new UpdateOperation($package, $curPackage);
  14820. }
  14821. }
  14822. break;
  14823. }
  14824. }
  14825. continue;
  14826. }
  14827. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14828. foreach ($matches as $index => $match) {
  14829. if (!in_array($match->getRepository(), $repositories, true)) {
  14830. unset($matches[$index]);
  14831. continue;
  14832. }
  14833. if ($match->getName() !== $package->getName()) {
  14834. unset($matches[$index]);
  14835. continue;
  14836. }
  14837. $matches[$index] = $match->getId();
  14838. }
  14839. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14840. $newPackage = $pool->literalToPackage($matches[0]);
  14841. if ($task === 'force-links' && $newPackage) {
  14842. $package->setRequires($newPackage->getRequires());
  14843. $package->setConflicts($newPackage->getConflicts());
  14844. $package->setProvides($newPackage->getProvides());
  14845. $package->setReplaces($newPackage->getReplaces());
  14846. }
  14847. if (
  14848. $task === 'force-updates'
  14849. && $newPackage
  14850. && (
  14851. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14852. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14853. )
  14854. ) {
  14855. $operations[] = new UpdateOperation($package, $newPackage);
  14856. continue;
  14857. }
  14858. }
  14859. if ($task === 'force-updates') {
  14860. $references = $this->package->getReferences();
  14861. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14862. $operations[] = new UpdateOperation($package, clone $package);
  14863. }
  14864. }
  14865. } else {
  14866. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14867. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14868. if ($task === 'force-links') {
  14869. $package->setRequires($lockedPackage->getRequires());
  14870. $package->setConflicts($lockedPackage->getConflicts());
  14871. $package->setProvides($lockedPackage->getProvides());
  14872. $package->setReplaces($lockedPackage->getReplaces());
  14873. } elseif ($task === 'force-updates') {
  14874. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14875. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14876. ) {
  14877. $operations[] = new UpdateOperation($package, $lockedPackage);
  14878. }
  14879. }
  14880. break;
  14881. }
  14882. }
  14883. }
  14884. }
  14885. return $operations;
  14886. }
  14887. private function getCurrentPackages($installedRepo)
  14888. {
  14889. if ($this->locker->isLocked()) {
  14890. try {
  14891. return $this->locker->getLockedRepository(true)->getPackages();
  14892. } catch (\RuntimeException $e) {
  14893. return $this->locker->getLockedRepository()->getPackages();
  14894. }
  14895. }
  14896. return $installedRepo->getPackages();
  14897. }
  14898. private function getRootAliases()
  14899. {
  14900. if ($this->update) {
  14901. $aliases = $this->package->getAliases();
  14902. } else {
  14903. $aliases = $this->locker->getAliases();
  14904. }
  14905. $normalizedAliases = array();
  14906. foreach ($aliases as $alias) {
  14907. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14908. 'alias' => $alias['alias'],
  14909. 'alias_normalized' => $alias['alias_normalized'],
  14910. );
  14911. }
  14912. return $normalizedAliases;
  14913. }
  14914. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14915. {
  14916. if (!$this->update) {
  14917. return;
  14918. }
  14919. $rootRefs = $this->package->getReferences();
  14920. foreach ($localRepo->getCanonicalPackages() as $package) {
  14921. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14922. foreach ($matches as $index => $match) {
  14923. if (!in_array($match->getRepository(), $repositories, true)) {
  14924. unset($matches[$index]);
  14925. continue;
  14926. }
  14927. if ($match->getName() !== $package->getName()) {
  14928. unset($matches[$index]);
  14929. continue;
  14930. }
  14931. $matches[$index] = $match->getId();
  14932. }
  14933. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14934. $newPackage = $pool->literalToPackage($matches[0]);
  14935. $sourceUrl = $package->getSourceUrl();
  14936. $newSourceUrl = $newPackage->getSourceUrl();
  14937. $newReference = $newPackage->getSourceReference();
  14938. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14939. $newReference = $rootRefs[$package->getName()];
  14940. }
  14941. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14942. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14943. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14944. }
  14945. $package->setDistMirrors($newPackage->getDistMirrors());
  14946. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14947. $package->setTransportOptions($newPackage->getTransportOptions());
  14948. }
  14949. }
  14950. }
  14951. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14952. {
  14953. $oldSourceRef = $package->getSourceReference();
  14954. if ($package->getSourceUrl() !== $sourceUrl) {
  14955. $package->setSourceType($sourceType);
  14956. $package->setSourceUrl($sourceUrl);
  14957. $package->setSourceReference($sourceReference);
  14958. }
  14959. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14960. $package->setDistUrl($distUrl);
  14961. $package->setDistType($distType);
  14962. $package->setDistSha1Checksum($distShaSum);
  14963. $this->updateInstallReferences($package, $sourceReference);
  14964. }
  14965. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14966. $this->updateInstallReferences($package, $oldSourceRef);
  14967. }
  14968. }
  14969. private function updateInstallReferences(PackageInterface $package, $reference)
  14970. {
  14971. if (!$reference) {
  14972. return;
  14973. }
  14974. $package->setSourceReference($reference);
  14975. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14976. $package->setDistReference($reference);
  14977. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14978. } elseif ($package->getDistReference()) {
  14979. $package->setDistReference($reference);
  14980. }
  14981. }
  14982. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14983. {
  14984. foreach ($aliases as $package => $versions) {
  14985. foreach ($versions as $version => $alias) {
  14986. $packages = $platformRepo->findPackages($package, $version);
  14987. foreach ($packages as $package) {
  14988. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14989. $aliasPackage->setRootPackageAlias(true);
  14990. $platformRepo->addPackage($aliasPackage);
  14991. }
  14992. }
  14993. }
  14994. }
  14995. private function isUpdateable(PackageInterface $package)
  14996. {
  14997. if (!$this->updateWhitelist) {
  14998. throw new \LogicException('isUpdateable should only be called when an allow list is present');
  14999. }
  15000. foreach ($this->updateWhitelist as $pattern => $void) {
  15001. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  15002. if (preg_match($patternRegexp, $package->getName())) {
  15003. return true;
  15004. }
  15005. }
  15006. return false;
  15007. }
  15008. private function extractPlatformRequirements($links)
  15009. {
  15010. $platformReqs = array();
  15011. foreach ($links as $link) {
  15012. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  15013. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  15014. }
  15015. }
  15016. return $platformReqs;
  15017. }
  15018. private function allowListUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  15019. {
  15020. if (!$this->updateWhitelist) {
  15021. return;
  15022. }
  15023. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  15024. $skipPackages = array();
  15025. if (!$this->whitelistAllDependencies) {
  15026. foreach ($rootRequires as $require) {
  15027. $skipPackages[$require->getTarget()] = true;
  15028. }
  15029. }
  15030. $pool = new Pool('dev');
  15031. $pool->addRepository($localOrLockRepo);
  15032. $seen = array();
  15033. $rootRequiredPackageNames = array_keys($rootRequires);
  15034. foreach ($this->updateWhitelist as $packageName => $void) {
  15035. $packageQueue = new \SplQueue;
  15036. $nameMatchesRequiredPackage = false;
  15037. $depPackages = $pool->whatProvides($packageName);
  15038. $matchesByPattern = array();
  15039. if (empty($depPackages)) {
  15040. $allowListPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  15041. foreach ($localOrLockRepo->search($allowListPatternSearchRegexp) as $installedPackage) {
  15042. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  15043. }
  15044. $allowListPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  15045. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  15046. if (preg_match($allowListPatternRegexp, $rootRequiredPackageName)) {
  15047. $nameMatchesRequiredPackage = true;
  15048. break;
  15049. }
  15050. }
  15051. }
  15052. if (!empty($matchesByPattern)) {
  15053. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  15054. }
  15055. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  15056. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  15057. }
  15058. foreach ($depPackages as $depPackage) {
  15059. $packageQueue->enqueue($depPackage);
  15060. }
  15061. while (!$packageQueue->isEmpty()) {
  15062. $package = $packageQueue->dequeue();
  15063. if (isset($seen[$package->getId()])) {
  15064. continue;
  15065. }
  15066. $seen[$package->getId()] = true;
  15067. $this->updateWhitelist[$package->getName()] = true;
  15068. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  15069. continue;
  15070. }
  15071. $requires = $package->getRequires();
  15072. foreach ($requires as $require) {
  15073. $requirePackages = $pool->whatProvides($require->getTarget());
  15074. foreach ($requirePackages as $requirePackage) {
  15075. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  15076. continue;
  15077. }
  15078. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  15079. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly allowed. Ignoring.</warning>');
  15080. continue;
  15081. }
  15082. $packageQueue->enqueue($requirePackage);
  15083. }
  15084. }
  15085. }
  15086. }
  15087. }
  15088. private function mockLocalRepositories(RepositoryManager $rm)
  15089. {
  15090. $packages = array();
  15091. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  15092. $packages[(string) $package] = clone $package;
  15093. }
  15094. foreach ($packages as $key => $package) {
  15095. if ($package instanceof AliasPackage) {
  15096. $alias = (string) $package->getAliasOf();
  15097. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  15098. }
  15099. }
  15100. $rm->setLocalRepository(
  15101. new InstalledArrayRepository($packages)
  15102. );
  15103. }
  15104. public static function create(IOInterface $io, Composer $composer)
  15105. {
  15106. return new static(
  15107. $io,
  15108. $composer->getConfig(),
  15109. $composer->getPackage(),
  15110. $composer->getDownloadManager(),
  15111. $composer->getRepositoryManager(),
  15112. $composer->getLocker(),
  15113. $composer->getInstallationManager(),
  15114. $composer->getEventDispatcher(),
  15115. $composer->getAutoloadGenerator()
  15116. );
  15117. }
  15118. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  15119. {
  15120. $this->additionalInstalledRepository = $additionalInstalledRepository;
  15121. return $this;
  15122. }
  15123. public function setDryRun($dryRun = true)
  15124. {
  15125. $this->dryRun = (bool) $dryRun;
  15126. return $this;
  15127. }
  15128. public function isDryRun()
  15129. {
  15130. return $this->dryRun;
  15131. }
  15132. public function setPreferSource($preferSource = true)
  15133. {
  15134. $this->preferSource = (bool) $preferSource;
  15135. return $this;
  15136. }
  15137. public function setPreferDist($preferDist = true)
  15138. {
  15139. $this->preferDist = (bool) $preferDist;
  15140. return $this;
  15141. }
  15142. public function setOptimizeAutoloader($optimizeAutoloader = false)
  15143. {
  15144. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  15145. if (!$this->optimizeAutoloader) {
  15146. $this->setClassMapAuthoritative(false);
  15147. }
  15148. return $this;
  15149. }
  15150. public function setClassMapAuthoritative($classMapAuthoritative = false)
  15151. {
  15152. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  15153. if ($this->classMapAuthoritative) {
  15154. $this->setOptimizeAutoloader(true);
  15155. }
  15156. return $this;
  15157. }
  15158. public function setApcuAutoloader($apcuAutoloader = false)
  15159. {
  15160. $this->apcuAutoloader = (bool) $apcuAutoloader;
  15161. return $this;
  15162. }
  15163. public function setUpdate($update = true)
  15164. {
  15165. $this->update = (bool) $update;
  15166. return $this;
  15167. }
  15168. public function setDevMode($devMode = true)
  15169. {
  15170. $this->devMode = (bool) $devMode;
  15171. return $this;
  15172. }
  15173. public function setDumpAutoloader($dumpAutoloader = true)
  15174. {
  15175. $this->dumpAutoloader = (bool) $dumpAutoloader;
  15176. return $this;
  15177. }
  15178. public function setRunScripts($runScripts = true)
  15179. {
  15180. $this->runScripts = (bool) $runScripts;
  15181. return $this;
  15182. }
  15183. public function setConfig(Config $config)
  15184. {
  15185. $this->config = $config;
  15186. return $this;
  15187. }
  15188. public function setVerbose($verbose = true)
  15189. {
  15190. $this->verbose = (bool) $verbose;
  15191. return $this;
  15192. }
  15193. public function isVerbose()
  15194. {
  15195. return $this->verbose;
  15196. }
  15197. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  15198. {
  15199. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  15200. return $this;
  15201. }
  15202. public function setUpdateWhitelist(array $packages)
  15203. {
  15204. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  15205. return $this;
  15206. }
  15207. public function setUpdateAllowList(array $packages)
  15208. {
  15209. return $this->setUpdateWhitelist($packages);
  15210. }
  15211. public function setWhitelistDependencies($updateDependencies = true)
  15212. {
  15213. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  15214. }
  15215. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  15216. {
  15217. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  15218. return $this;
  15219. }
  15220. public function setAllowListTransitiveDependencies($updateTransitiveDependencies = true)
  15221. {
  15222. return $this->setWhitelistTransitiveDependencies($updateTransitiveDependencies);
  15223. }
  15224. public function setWhitelistAllDependencies($updateAllDependencies = true)
  15225. {
  15226. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  15227. return $this;
  15228. }
  15229. public function setAllowListAllDependencies($updateAllDependencies = true)
  15230. {
  15231. return $this->setWhitelistAllDependencies($updateAllDependencies);
  15232. }
  15233. public function setPreferStable($preferStable = true)
  15234. {
  15235. $this->preferStable = (bool) $preferStable;
  15236. return $this;
  15237. }
  15238. public function setPreferLowest($preferLowest = true)
  15239. {
  15240. $this->preferLowest = (bool) $preferLowest;
  15241. return $this;
  15242. }
  15243. public function setWriteLock($writeLock = true)
  15244. {
  15245. $this->writeLock = (bool) $writeLock;
  15246. return $this;
  15247. }
  15248. public function setExecuteOperations($executeOperations = true)
  15249. {
  15250. $this->executeOperations = (bool) $executeOperations;
  15251. return $this;
  15252. }
  15253. public function setSkipSuggest($skipSuggest = true)
  15254. {
  15255. $this->skipSuggest = (bool) $skipSuggest;
  15256. return $this;
  15257. }
  15258. public function disablePlugins()
  15259. {
  15260. $this->installationManager->disablePlugins();
  15261. return $this;
  15262. }
  15263. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  15264. {
  15265. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  15266. return $this;
  15267. }
  15268. }
  15269. <?php
  15270. namespace Composer\Installer;
  15271. use Composer\IO\IOInterface;
  15272. use Composer\Package\PackageInterface;
  15273. use Composer\Util\Filesystem;
  15274. use Composer\Util\Platform;
  15275. use Composer\Util\ProcessExecutor;
  15276. use Composer\Util\Silencer;
  15277. class BinaryInstaller
  15278. {
  15279. protected $binDir;
  15280. protected $binCompat;
  15281. protected $io;
  15282. protected $filesystem;
  15283. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  15284. {
  15285. $this->binDir = $binDir;
  15286. $this->binCompat = $binCompat;
  15287. $this->io = $io;
  15288. $this->filesystem = $filesystem ?: new Filesystem();
  15289. }
  15290. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  15291. {
  15292. $binaries = $this->getBinaries($package);
  15293. if (!$binaries) {
  15294. return;
  15295. }
  15296. foreach ($binaries as $bin) {
  15297. $binPath = $installPath.'/'.$bin;
  15298. if (!file_exists($binPath)) {
  15299. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  15300. continue;
  15301. }
  15302. $binPath = realpath($binPath);
  15303. $this->initializeBinDir();
  15304. $link = $this->binDir.'/'.basename($bin);
  15305. if (file_exists($link)) {
  15306. if (is_link($link)) {
  15307. Silencer::call('chmod', $link, 0777 & ~umask());
  15308. }
  15309. if ($warnOnOverwrite) {
  15310. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  15311. }
  15312. continue;
  15313. }
  15314. if ($this->binCompat === "auto") {
  15315. if (Platform::isWindows()) {
  15316. $this->installFullBinaries($binPath, $link, $bin, $package);
  15317. } else {
  15318. $this->installSymlinkBinaries($binPath, $link);
  15319. }
  15320. } elseif ($this->binCompat === "full") {
  15321. $this->installFullBinaries($binPath, $link, $bin, $package);
  15322. }
  15323. Silencer::call('chmod', $link, 0777 & ~umask());
  15324. }
  15325. }
  15326. public function removeBinaries(PackageInterface $package)
  15327. {
  15328. $this->initializeBinDir();
  15329. $binaries = $this->getBinaries($package);
  15330. if (!$binaries) {
  15331. return;
  15332. }
  15333. foreach ($binaries as $bin) {
  15334. $link = $this->binDir.'/'.basename($bin);
  15335. if (is_link($link) || file_exists($link)) {
  15336. $this->filesystem->unlink($link);
  15337. }
  15338. if (file_exists($link.'.bat')) {
  15339. $this->filesystem->unlink($link.'.bat');
  15340. }
  15341. }
  15342. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  15343. Silencer::call('rmdir', $this->binDir);
  15344. }
  15345. }
  15346. public static function determineBinaryCaller($bin)
  15347. {
  15348. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  15349. return 'call';
  15350. }
  15351. $handle = fopen($bin, 'r');
  15352. $line = fgets($handle);
  15353. fclose($handle);
  15354. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15355. return trim($match[1]);
  15356. }
  15357. return 'php';
  15358. }
  15359. protected function getBinaries(PackageInterface $package)
  15360. {
  15361. return $package->getBinaries();
  15362. }
  15363. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  15364. {
  15365. if ('.bat' !== substr($binPath, -4)) {
  15366. $this->installUnixyProxyBinaries($binPath, $link);
  15367. @chmod($link, 0777 & ~umask());
  15368. $link .= '.bat';
  15369. if (file_exists($link)) {
  15370. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  15371. }
  15372. }
  15373. if (!file_exists($link)) {
  15374. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  15375. }
  15376. }
  15377. protected function installSymlinkBinaries($binPath, $link)
  15378. {
  15379. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  15380. $this->installUnixyProxyBinaries($binPath, $link);
  15381. }
  15382. }
  15383. protected function installUnixyProxyBinaries($binPath, $link)
  15384. {
  15385. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  15386. }
  15387. protected function initializeBinDir()
  15388. {
  15389. $this->filesystem->ensureDirectoryExists($this->binDir);
  15390. $this->binDir = realpath($this->binDir);
  15391. }
  15392. protected function generateWindowsProxyCode($bin, $link)
  15393. {
  15394. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15395. $caller = self::determineBinaryCaller($bin);
  15396. return "@ECHO OFF\r\n".
  15397. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  15398. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  15399. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  15400. }
  15401. protected function generateUnixyProxyCode($bin, $link)
  15402. {
  15403. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15404. $binDir = ProcessExecutor::escape(dirname($binPath));
  15405. $binFile = basename($binPath);
  15406. $proxyCode = <<<PROXY
  15407. #!/usr/bin/env sh
  15408. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  15409. if [ -d /proc/cygdrive ]; then
  15410. case \$(which php) in
  15411. \$(readlink -n /proc/cygdrive)/*)
  15412. # We are in Cygwin using Windows php, so the path must be translated
  15413. dir=\$(cygpath -m "\$dir");
  15414. ;;
  15415. esac
  15416. fi
  15417. "\${dir}/$binFile" "\$@"
  15418. PROXY;
  15419. return $proxyCode;
  15420. }
  15421. }
  15422. <?php
  15423. namespace Composer\Installer;
  15424. use Composer\Package\PackageInterface;
  15425. interface BinaryPresenceInterface
  15426. {
  15427. public function ensureBinariesPresence(PackageInterface $package);
  15428. }
  15429. <?php
  15430. namespace Composer\Installer;
  15431. use Composer\IO\IOInterface;
  15432. use Composer\Package\PackageInterface;
  15433. use Composer\Package\AliasPackage;
  15434. use Composer\Repository\RepositoryInterface;
  15435. use Composer\Repository\InstalledRepositoryInterface;
  15436. use Composer\DependencyResolver\Operation\OperationInterface;
  15437. use Composer\DependencyResolver\Operation\InstallOperation;
  15438. use Composer\DependencyResolver\Operation\UpdateOperation;
  15439. use Composer\DependencyResolver\Operation\UninstallOperation;
  15440. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  15441. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  15442. use Composer\Util\StreamContextFactory;
  15443. class InstallationManager
  15444. {
  15445. private $installers = array();
  15446. private $cache = array();
  15447. private $notifiablePackages = array();
  15448. public function reset()
  15449. {
  15450. $this->notifiablePackages = array();
  15451. }
  15452. public function addInstaller(InstallerInterface $installer)
  15453. {
  15454. array_unshift($this->installers, $installer);
  15455. $this->cache = array();
  15456. }
  15457. public function removeInstaller(InstallerInterface $installer)
  15458. {
  15459. if (false !== ($key = array_search($installer, $this->installers, true))) {
  15460. array_splice($this->installers, $key, 1);
  15461. $this->cache = array();
  15462. }
  15463. }
  15464. public function disablePlugins()
  15465. {
  15466. foreach ($this->installers as $i => $installer) {
  15467. if (!$installer instanceof PluginInstaller) {
  15468. continue;
  15469. }
  15470. unset($this->installers[$i]);
  15471. }
  15472. }
  15473. public function getInstaller($type)
  15474. {
  15475. $type = strtolower($type);
  15476. if (isset($this->cache[$type])) {
  15477. return $this->cache[$type];
  15478. }
  15479. foreach ($this->installers as $installer) {
  15480. if ($installer->supports($type)) {
  15481. return $this->cache[$type] = $installer;
  15482. }
  15483. }
  15484. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  15485. }
  15486. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15487. {
  15488. if ($package instanceof AliasPackage) {
  15489. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  15490. }
  15491. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  15492. }
  15493. public function ensureBinariesPresence(PackageInterface $package)
  15494. {
  15495. try {
  15496. $installer = $this->getInstaller($package->getType());
  15497. } catch (\InvalidArgumentException $e) {
  15498. return;
  15499. }
  15500. if ($installer instanceof BinaryPresenceInterface) {
  15501. $installer->ensureBinariesPresence($package);
  15502. }
  15503. }
  15504. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  15505. {
  15506. $method = $operation->getJobType();
  15507. $this->$method($repo, $operation);
  15508. }
  15509. public function install(RepositoryInterface $repo, InstallOperation $operation)
  15510. {
  15511. $package = $operation->getPackage();
  15512. $installer = $this->getInstaller($package->getType());
  15513. $installer->install($repo, $package);
  15514. $this->markForNotification($package);
  15515. }
  15516. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  15517. {
  15518. $initial = $operation->getInitialPackage();
  15519. $target = $operation->getTargetPackage();
  15520. $initialType = $initial->getType();
  15521. $targetType = $target->getType();
  15522. if ($initialType === $targetType) {
  15523. $installer = $this->getInstaller($initialType);
  15524. $installer->update($repo, $initial, $target);
  15525. $this->markForNotification($target);
  15526. } else {
  15527. $this->getInstaller($initialType)->uninstall($repo, $initial);
  15528. $this->getInstaller($targetType)->install($repo, $target);
  15529. }
  15530. }
  15531. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  15532. {
  15533. $package = $operation->getPackage();
  15534. $installer = $this->getInstaller($package->getType());
  15535. $installer->uninstall($repo, $package);
  15536. }
  15537. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  15538. {
  15539. $package = $operation->getPackage();
  15540. if (!$repo->hasPackage($package)) {
  15541. $repo->addPackage(clone $package);
  15542. }
  15543. }
  15544. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  15545. {
  15546. $package = $operation->getPackage();
  15547. $repo->removePackage($package);
  15548. }
  15549. public function getInstallPath(PackageInterface $package)
  15550. {
  15551. $installer = $this->getInstaller($package->getType());
  15552. return $installer->getInstallPath($package);
  15553. }
  15554. public function notifyInstalls(IOInterface $io)
  15555. {
  15556. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  15557. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  15558. if ($io->hasAuthentication($repositoryName)) {
  15559. $auth = $io->getAuthentication($repositoryName);
  15560. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  15561. $authHeader = 'Authorization: Basic '.$authStr;
  15562. }
  15563. if (strpos($repoUrl, '%package%')) {
  15564. foreach ($packages as $package) {
  15565. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  15566. $params = array(
  15567. 'version' => $package->getPrettyVersion(),
  15568. 'version_normalized' => $package->getVersion(),
  15569. );
  15570. $opts = array('http' =>
  15571. array(
  15572. 'method' => 'POST',
  15573. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  15574. 'content' => http_build_query($params, '', '&'),
  15575. 'timeout' => 3,
  15576. ),
  15577. );
  15578. if (isset($authHeader)) {
  15579. $opts['http']['header'][] = $authHeader;
  15580. }
  15581. $context = StreamContextFactory::getContext($url, $opts);
  15582. @file_get_contents($url, false, $context);
  15583. }
  15584. continue;
  15585. }
  15586. $postData = array('downloads' => array());
  15587. foreach ($packages as $package) {
  15588. $postData['downloads'][] = array(
  15589. 'name' => $package->getPrettyName(),
  15590. 'version' => $package->getVersion(),
  15591. );
  15592. }
  15593. $opts = array('http' =>
  15594. array(
  15595. 'method' => 'POST',
  15596. 'header' => array('Content-Type: application/json'),
  15597. 'content' => json_encode($postData),
  15598. 'timeout' => 6,
  15599. ),
  15600. );
  15601. if (isset($authHeader)) {
  15602. $opts['http']['header'][] = $authHeader;
  15603. }
  15604. $context = StreamContextFactory::getContext($repoUrl, $opts);
  15605. @file_get_contents($repoUrl, false, $context);
  15606. }
  15607. $this->reset();
  15608. }
  15609. private function markForNotification(PackageInterface $package)
  15610. {
  15611. if ($package->getNotificationUrl()) {
  15612. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  15613. }
  15614. }
  15615. }
  15616. <?php
  15617. namespace Composer\Installer;
  15618. use Composer\Composer;
  15619. use Composer\DependencyResolver\PolicyInterface;
  15620. use Composer\DependencyResolver\Operation\OperationInterface;
  15621. use Composer\DependencyResolver\Pool;
  15622. use Composer\DependencyResolver\Request;
  15623. use Composer\EventDispatcher\Event;
  15624. use Composer\IO\IOInterface;
  15625. use Composer\Repository\CompositeRepository;
  15626. class InstallerEvent extends Event
  15627. {
  15628. private $composer;
  15629. private $io;
  15630. private $devMode;
  15631. private $policy;
  15632. private $pool;
  15633. private $installedRepo;
  15634. private $request;
  15635. private $operations;
  15636. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  15637. {
  15638. parent::__construct($eventName);
  15639. $this->composer = $composer;
  15640. $this->io = $io;
  15641. $this->devMode = $devMode;
  15642. $this->policy = $policy;
  15643. $this->pool = $pool;
  15644. $this->installedRepo = $installedRepo;
  15645. $this->request = $request;
  15646. $this->operations = $operations;
  15647. }
  15648. public function getComposer()
  15649. {
  15650. return $this->composer;
  15651. }
  15652. public function getIO()
  15653. {
  15654. return $this->io;
  15655. }
  15656. public function isDevMode()
  15657. {
  15658. return $this->devMode;
  15659. }
  15660. public function getPolicy()
  15661. {
  15662. return $this->policy;
  15663. }
  15664. public function getPool()
  15665. {
  15666. return $this->pool;
  15667. }
  15668. public function getInstalledRepo()
  15669. {
  15670. return $this->installedRepo;
  15671. }
  15672. public function getRequest()
  15673. {
  15674. return $this->request;
  15675. }
  15676. public function getOperations()
  15677. {
  15678. return $this->operations;
  15679. }
  15680. }
  15681. <?php
  15682. namespace Composer\Installer;
  15683. class InstallerEvents
  15684. {
  15685. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15686. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15687. }
  15688. <?php
  15689. namespace Composer\Installer;
  15690. use Composer\Package\PackageInterface;
  15691. use Composer\Repository\InstalledRepositoryInterface;
  15692. use InvalidArgumentException;
  15693. interface InstallerInterface
  15694. {
  15695. public function supports($packageType);
  15696. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15697. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15698. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15699. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15700. public function getInstallPath(PackageInterface $package);
  15701. }
  15702. <?php
  15703. namespace Composer\Installer;
  15704. use Composer\Composer;
  15705. use Composer\IO\IOInterface;
  15706. use Composer\Repository\InstalledRepositoryInterface;
  15707. use Composer\Package\PackageInterface;
  15708. use Composer\Util\Filesystem;
  15709. use Composer\Util\Silencer;
  15710. use Composer\Util\Platform;
  15711. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15712. {
  15713. protected $composer;
  15714. protected $vendorDir;
  15715. protected $binDir;
  15716. protected $downloadManager;
  15717. protected $io;
  15718. protected $type;
  15719. protected $filesystem;
  15720. protected $binCompat;
  15721. protected $binaryInstaller;
  15722. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15723. {
  15724. $this->composer = $composer;
  15725. $this->downloadManager = $composer->getDownloadManager();
  15726. $this->io = $io;
  15727. $this->type = $type;
  15728. $this->filesystem = $filesystem ?: new Filesystem();
  15729. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15730. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15731. }
  15732. public function supports($packageType)
  15733. {
  15734. return $packageType === $this->type || null === $this->type;
  15735. }
  15736. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15737. {
  15738. if (!$repo->hasPackage($package)) {
  15739. return false;
  15740. }
  15741. $installPath = $this->getInstallPath($package);
  15742. if (is_readable($installPath)) {
  15743. return true;
  15744. }
  15745. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15746. }
  15747. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15748. {
  15749. $this->initializeVendorDir();
  15750. $downloadPath = $this->getInstallPath($package);
  15751. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15752. $this->binaryInstaller->removeBinaries($package);
  15753. }
  15754. $this->installCode($package);
  15755. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15756. if (!$repo->hasPackage($package)) {
  15757. $repo->addPackage(clone $package);
  15758. }
  15759. }
  15760. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15761. {
  15762. if (!$repo->hasPackage($initial)) {
  15763. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15764. }
  15765. $this->initializeVendorDir();
  15766. $this->binaryInstaller->removeBinaries($initial);
  15767. $this->updateCode($initial, $target);
  15768. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15769. $repo->removePackage($initial);
  15770. if (!$repo->hasPackage($target)) {
  15771. $repo->addPackage(clone $target);
  15772. }
  15773. }
  15774. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15775. {
  15776. if (!$repo->hasPackage($package)) {
  15777. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15778. }
  15779. $this->removeCode($package);
  15780. $this->binaryInstaller->removeBinaries($package);
  15781. $repo->removePackage($package);
  15782. $downloadPath = $this->getPackageBasePath($package);
  15783. if (strpos($package->getName(), '/')) {
  15784. $packageVendorDir = dirname($downloadPath);
  15785. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15786. Silencer::call('rmdir', $packageVendorDir);
  15787. }
  15788. }
  15789. }
  15790. public function getInstallPath(PackageInterface $package)
  15791. {
  15792. $this->initializeVendorDir();
  15793. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15794. $targetDir = $package->getTargetDir();
  15795. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15796. }
  15797. public function ensureBinariesPresence(PackageInterface $package)
  15798. {
  15799. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15800. }
  15801. protected function getPackageBasePath(PackageInterface $package)
  15802. {
  15803. $installPath = $this->getInstallPath($package);
  15804. $targetDir = $package->getTargetDir();
  15805. if ($targetDir) {
  15806. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15807. }
  15808. return $installPath;
  15809. }
  15810. protected function installCode(PackageInterface $package)
  15811. {
  15812. $downloadPath = $this->getInstallPath($package);
  15813. $this->downloadManager->download($package, $downloadPath);
  15814. }
  15815. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15816. {
  15817. $initialDownloadPath = $this->getInstallPath($initial);
  15818. $targetDownloadPath = $this->getInstallPath($target);
  15819. if ($targetDownloadPath !== $initialDownloadPath) {
  15820. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15821. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15822. ) {
  15823. $this->removeCode($initial);
  15824. $this->installCode($target);
  15825. return;
  15826. }
  15827. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15828. }
  15829. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15830. }
  15831. protected function removeCode(PackageInterface $package)
  15832. {
  15833. $downloadPath = $this->getPackageBasePath($package);
  15834. $this->downloadManager->remove($package, $downloadPath);
  15835. }
  15836. protected function initializeVendorDir()
  15837. {
  15838. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15839. $this->vendorDir = realpath($this->vendorDir);
  15840. }
  15841. }
  15842. <?php
  15843. namespace Composer\Installer;
  15844. use Composer\Repository\InstalledRepositoryInterface;
  15845. use Composer\Package\PackageInterface;
  15846. use Composer\Package\Version\VersionParser;
  15847. use Composer\IO\IOInterface;
  15848. class MetapackageInstaller implements InstallerInterface
  15849. {
  15850. private $io;
  15851. public function __construct(IOInterface $io)
  15852. {
  15853. $this->io = $io;
  15854. }
  15855. public function supports($packageType)
  15856. {
  15857. return $packageType === 'metapackage';
  15858. }
  15859. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15860. {
  15861. return $repo->hasPackage($package);
  15862. }
  15863. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15864. {
  15865. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15866. $repo->addPackage(clone $package);
  15867. }
  15868. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15869. {
  15870. if (!$repo->hasPackage($initial)) {
  15871. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15872. }
  15873. $name = $target->getName();
  15874. $from = $initial->getFullPrettyVersion();
  15875. $to = $target->getFullPrettyVersion();
  15876. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15877. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15878. $repo->removePackage($initial);
  15879. $repo->addPackage(clone $target);
  15880. }
  15881. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15882. {
  15883. if (!$repo->hasPackage($package)) {
  15884. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15885. }
  15886. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15887. $repo->removePackage($package);
  15888. }
  15889. public function getInstallPath(PackageInterface $package)
  15890. {
  15891. return '';
  15892. }
  15893. }
  15894. <?php
  15895. namespace Composer\Installer;
  15896. use Composer\Repository\InstalledRepositoryInterface;
  15897. use Composer\Package\PackageInterface;
  15898. class NoopInstaller implements InstallerInterface
  15899. {
  15900. public function supports($packageType)
  15901. {
  15902. return true;
  15903. }
  15904. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15905. {
  15906. return $repo->hasPackage($package);
  15907. }
  15908. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15909. {
  15910. if (!$repo->hasPackage($package)) {
  15911. $repo->addPackage(clone $package);
  15912. }
  15913. }
  15914. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15915. {
  15916. if (!$repo->hasPackage($initial)) {
  15917. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15918. }
  15919. $repo->removePackage($initial);
  15920. if (!$repo->hasPackage($target)) {
  15921. $repo->addPackage(clone $target);
  15922. }
  15923. }
  15924. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15925. {
  15926. if (!$repo->hasPackage($package)) {
  15927. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15928. }
  15929. $repo->removePackage($package);
  15930. }
  15931. public function getInstallPath(PackageInterface $package)
  15932. {
  15933. $targetDir = $package->getTargetDir();
  15934. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15935. }
  15936. }
  15937. <?php
  15938. namespace Composer\Installer;
  15939. use Composer\Composer;
  15940. use Composer\IO\IOInterface;
  15941. use Composer\DependencyResolver\Operation\OperationInterface;
  15942. use Composer\DependencyResolver\PolicyInterface;
  15943. use Composer\DependencyResolver\Pool;
  15944. use Composer\DependencyResolver\Request;
  15945. use Composer\Repository\CompositeRepository;
  15946. class PackageEvent extends InstallerEvent
  15947. {
  15948. private $operation;
  15949. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15950. {
  15951. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15952. $this->operation = $operation;
  15953. }
  15954. public function getOperation()
  15955. {
  15956. return $this->operation;
  15957. }
  15958. }
  15959. <?php
  15960. namespace Composer\Installer;
  15961. class PackageEvents
  15962. {
  15963. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15964. const POST_PACKAGE_INSTALL = 'post-package-install';
  15965. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15966. const POST_PACKAGE_UPDATE = 'post-package-update';
  15967. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15968. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15969. }
  15970. <?php
  15971. namespace Composer\Installer;
  15972. use Composer\IO\IOInterface;
  15973. use Composer\Package\PackageInterface;
  15974. use Composer\Util\Filesystem;
  15975. use Composer\Util\ProcessExecutor;
  15976. class PearBinaryInstaller extends BinaryInstaller
  15977. {
  15978. private $installer;
  15979. private $vendorDir;
  15980. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15981. {
  15982. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15983. $this->installer = $installer;
  15984. $this->vendorDir = $vendorDir;
  15985. }
  15986. protected function getBinaries(PackageInterface $package)
  15987. {
  15988. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15989. $binaries = array();
  15990. if (file_exists($binariesPath)) {
  15991. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15992. if (!$value->isDir()) {
  15993. $binaries[] = 'bin/'.$fileName;
  15994. }
  15995. }
  15996. }
  15997. return $binaries;
  15998. }
  15999. protected function initializeBinDir()
  16000. {
  16001. parent::initializeBinDir();
  16002. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  16003. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  16004. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  16005. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  16006. }
  16007. protected function generateWindowsProxyCode($bin, $link)
  16008. {
  16009. $binPath = $this->filesystem->findShortestPath($link, $bin);
  16010. if ('.bat' === substr($bin, -4)) {
  16011. $caller = 'call';
  16012. } else {
  16013. $handle = fopen($bin, 'r');
  16014. $line = fgets($handle);
  16015. fclose($handle);
  16016. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  16017. $caller = trim($match[1]);
  16018. } else {
  16019. $caller = 'php';
  16020. }
  16021. if ($caller === 'php') {
  16022. return "@echo off\r\n".
  16023. "pushd .\r\n".
  16024. "cd %~dp0\r\n".
  16025. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  16026. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16027. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16028. "popd\r\n".
  16029. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  16030. }
  16031. }
  16032. return "@echo off\r\n".
  16033. "pushd .\r\n".
  16034. "cd %~dp0\r\n".
  16035. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16036. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16037. "popd\r\n".
  16038. $caller." \"%BIN_TARGET%\" %*\r\n";
  16039. }
  16040. private function generateWindowsPhpProxyCode()
  16041. {
  16042. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16043. return
  16044. "@echo off\r\n" .
  16045. "setlocal enabledelayedexpansion\r\n" .
  16046. "set BIN_DIR=%~dp0\r\n" .
  16047. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  16048. "set DIRS=.\r\n" .
  16049. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  16050. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  16051. " set DIRS=!DIRS!;%%~fP\r\n" .
  16052. " )\r\n" .
  16053. ")\r\n" .
  16054. "php.exe -d include_path=!DIRS! %*\r\n";
  16055. }
  16056. private function generateUnixyPhpProxyCode()
  16057. {
  16058. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16059. return
  16060. "#!/usr/bin/env sh\n".
  16061. "SRC_DIR=`pwd`\n".
  16062. "BIN_DIR=`dirname $0`\n".
  16063. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  16064. "DIRS=\"\"\n".
  16065. "for vendor in \$VENDOR_DIR/*; do\n".
  16066. " if [ -d \"\$vendor\" ]; then\n".
  16067. " for package in \$vendor/*; do\n".
  16068. " if [ -d \"\$package\" ]; then\n".
  16069. " DIRS=\"\${DIRS}:\${package}\"\n".
  16070. " fi\n".
  16071. " done\n".
  16072. " fi\n".
  16073. "done\n".
  16074. "php -d include_path=\".\$DIRS\" $@\n";
  16075. }
  16076. }
  16077. <?php
  16078. namespace Composer\Installer;
  16079. use Composer\IO\IOInterface;
  16080. use Composer\Composer;
  16081. use Composer\Downloader\PearPackageExtractor;
  16082. use Composer\Repository\InstalledRepositoryInterface;
  16083. use Composer\Package\PackageInterface;
  16084. use Composer\Util\Platform;
  16085. use Composer\Util\Filesystem;
  16086. class PearInstaller extends LibraryInstaller
  16087. {
  16088. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  16089. {
  16090. $filesystem = new Filesystem();
  16091. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  16092. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  16093. }
  16094. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16095. {
  16096. $this->uninstall($repo, $initial);
  16097. $this->install($repo, $target);
  16098. }
  16099. protected function installCode(PackageInterface $package)
  16100. {
  16101. parent::installCode($package);
  16102. $isWindows = Platform::isWindows();
  16103. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  16104. if (!$isWindows) {
  16105. $php_bin = '/usr/bin/env ' . $php_bin;
  16106. }
  16107. $installPath = $this->getInstallPath($package);
  16108. $vars = array(
  16109. 'os' => $isWindows ? 'windows' : 'linux',
  16110. 'php_bin' => $php_bin,
  16111. 'pear_php' => $installPath,
  16112. 'php_dir' => $installPath,
  16113. 'bin_dir' => $installPath . '/bin',
  16114. 'data_dir' => $installPath . '/data',
  16115. 'version' => $package->getPrettyVersion(),
  16116. );
  16117. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  16118. $pearExtractor = new PearPackageExtractor($packageArchive);
  16119. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  16120. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  16121. $this->filesystem->unlink($packageArchive);
  16122. }
  16123. }
  16124. <?php
  16125. namespace Composer\Installer;
  16126. use Composer\Composer;
  16127. use Composer\IO\IOInterface;
  16128. use Composer\Repository\InstalledRepositoryInterface;
  16129. use Composer\Package\PackageInterface;
  16130. class PluginInstaller extends LibraryInstaller
  16131. {
  16132. private $installationManager;
  16133. public function __construct(IOInterface $io, Composer $composer)
  16134. {
  16135. parent::__construct($io, $composer, 'composer-plugin');
  16136. $this->installationManager = $composer->getInstallationManager();
  16137. }
  16138. public function supports($packageType)
  16139. {
  16140. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  16141. }
  16142. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16143. {
  16144. $extra = $package->getExtra();
  16145. if (empty($extra['class'])) {
  16146. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16147. }
  16148. parent::install($repo, $package);
  16149. try {
  16150. $this->composer->getPluginManager()->registerPackage($package, true);
  16151. } catch (\Exception $e) {
  16152. $this->io->writeError('Plugin installation failed ('.$e->getMessage().'), rolling back');
  16153. parent::uninstall($repo, $package);
  16154. throw $e;
  16155. }
  16156. }
  16157. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16158. {
  16159. $extra = $target->getExtra();
  16160. if (empty($extra['class'])) {
  16161. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16162. }
  16163. parent::update($repo, $initial, $target);
  16164. $this->composer->getPluginManager()->registerPackage($target, true);
  16165. }
  16166. }
  16167. <?php
  16168. namespace Composer\Installer;
  16169. use Composer\Package\PackageInterface;
  16170. use Composer\Downloader\DownloadManager;
  16171. use Composer\Repository\InstalledRepositoryInterface;
  16172. use Composer\Util\Filesystem;
  16173. class ProjectInstaller implements InstallerInterface
  16174. {
  16175. private $installPath;
  16176. private $downloadManager;
  16177. private $filesystem;
  16178. public function __construct($installPath, DownloadManager $dm)
  16179. {
  16180. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  16181. $this->downloadManager = $dm;
  16182. $this->filesystem = new Filesystem;
  16183. }
  16184. public function supports($packageType)
  16185. {
  16186. return true;
  16187. }
  16188. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  16189. {
  16190. return false;
  16191. }
  16192. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16193. {
  16194. $installPath = $this->installPath;
  16195. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  16196. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  16197. }
  16198. if (!is_dir($installPath)) {
  16199. mkdir($installPath, 0777, true);
  16200. }
  16201. $this->downloadManager->download($package, $installPath);
  16202. }
  16203. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16204. {
  16205. throw new \InvalidArgumentException("not supported");
  16206. }
  16207. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  16208. {
  16209. throw new \InvalidArgumentException("not supported");
  16210. }
  16211. public function getInstallPath(PackageInterface $package)
  16212. {
  16213. return $this->installPath;
  16214. }
  16215. }
  16216. <?php
  16217. namespace Composer\Installer;
  16218. use Composer\IO\IOInterface;
  16219. use Composer\Package\PackageInterface;
  16220. use Composer\Repository\RepositoryInterface;
  16221. use Symfony\Component\Console\Formatter\OutputFormatter;
  16222. class SuggestedPackagesReporter
  16223. {
  16224. protected $suggestedPackages = array();
  16225. private $io;
  16226. public function __construct(IOInterface $io)
  16227. {
  16228. $this->io = $io;
  16229. }
  16230. public function getPackages()
  16231. {
  16232. return $this->suggestedPackages;
  16233. }
  16234. public function addPackage($source, $target, $reason)
  16235. {
  16236. $this->suggestedPackages[] = array(
  16237. 'source' => $source,
  16238. 'target' => $target,
  16239. 'reason' => $reason,
  16240. );
  16241. return $this;
  16242. }
  16243. public function addSuggestionsFromPackage(PackageInterface $package)
  16244. {
  16245. $source = $package->getPrettyName();
  16246. foreach ($package->getSuggests() as $target => $reason) {
  16247. $this->addPackage(
  16248. $source,
  16249. $target,
  16250. $reason
  16251. );
  16252. }
  16253. return $this;
  16254. }
  16255. public function output(RepositoryInterface $installedRepo = null)
  16256. {
  16257. $suggestedPackages = $this->getPackages();
  16258. $installedPackages = array();
  16259. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  16260. foreach ($installedRepo->getPackages() as $package) {
  16261. $installedPackages = array_merge(
  16262. $installedPackages,
  16263. $package->getNames()
  16264. );
  16265. }
  16266. }
  16267. foreach ($suggestedPackages as $suggestion) {
  16268. if (in_array($suggestion['target'], $installedPackages)) {
  16269. continue;
  16270. }
  16271. $this->io->writeError(sprintf(
  16272. '%s suggests installing %s%s',
  16273. $suggestion['source'],
  16274. $this->escapeOutput($suggestion['target']),
  16275. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  16276. ));
  16277. }
  16278. return $this;
  16279. }
  16280. private function escapeOutput($string)
  16281. {
  16282. return OutputFormatter::escape(
  16283. $this->removeControlCharacters($string)
  16284. );
  16285. }
  16286. private function removeControlCharacters($string)
  16287. {
  16288. return preg_replace(
  16289. '/[[:cntrl:]]/',
  16290. '',
  16291. str_replace("\n", ' ', $string)
  16292. );
  16293. }
  16294. }
  16295. <?php
  16296. namespace Composer\Json;
  16297. use JsonSchema\Validator;
  16298. use Seld\JsonLint\JsonParser;
  16299. use Seld\JsonLint\ParsingException;
  16300. use Composer\Util\RemoteFilesystem;
  16301. use Composer\IO\IOInterface;
  16302. use Composer\Downloader\TransportException;
  16303. class JsonFile
  16304. {
  16305. const LAX_SCHEMA = 1;
  16306. const STRICT_SCHEMA = 2;
  16307. const JSON_UNESCAPED_SLASHES = 64;
  16308. const JSON_PRETTY_PRINT = 128;
  16309. const JSON_UNESCAPED_UNICODE = 256;
  16310. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  16311. private $path;
  16312. private $rfs;
  16313. private $io;
  16314. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  16315. {
  16316. $this->path = $path;
  16317. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  16318. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  16319. }
  16320. $this->rfs = $rfs;
  16321. $this->io = $io;
  16322. }
  16323. public function getPath()
  16324. {
  16325. return $this->path;
  16326. }
  16327. public function exists()
  16328. {
  16329. return is_file($this->path);
  16330. }
  16331. public function read()
  16332. {
  16333. try {
  16334. if ($this->rfs) {
  16335. $json = $this->rfs->getContents($this->path, $this->path, false);
  16336. } else {
  16337. if ($this->io && $this->io->isDebug()) {
  16338. $this->io->writeError('Reading ' . $this->path);
  16339. }
  16340. $json = file_get_contents($this->path);
  16341. }
  16342. } catch (TransportException $e) {
  16343. throw new \RuntimeException($e->getMessage(), 0, $e);
  16344. } catch (\Exception $e) {
  16345. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  16346. }
  16347. return static::parseJson($json, $this->path);
  16348. }
  16349. public function write(array $hash, $options = 448)
  16350. {
  16351. $dir = dirname($this->path);
  16352. if (!is_dir($dir)) {
  16353. if (file_exists($dir)) {
  16354. throw new \UnexpectedValueException(
  16355. $dir.' exists and is not a directory.'
  16356. );
  16357. }
  16358. if (!@mkdir($dir, 0777, true)) {
  16359. throw new \UnexpectedValueException(
  16360. $dir.' does not exist and could not be created.'
  16361. );
  16362. }
  16363. }
  16364. $retries = 3;
  16365. while ($retries--) {
  16366. try {
  16367. $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  16368. break;
  16369. } catch (\Exception $e) {
  16370. if ($retries) {
  16371. usleep(500000);
  16372. continue;
  16373. }
  16374. throw $e;
  16375. }
  16376. }
  16377. }
  16378. private function filePutContentsIfModified($path, $content)
  16379. {
  16380. $currentContent = @file_get_contents($path);
  16381. if (!$currentContent || ($currentContent != $content)) {
  16382. return file_put_contents($path, $content);
  16383. }
  16384. return 0;
  16385. }
  16386. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  16387. {
  16388. $content = file_get_contents($this->path);
  16389. $data = json_decode($content);
  16390. if (null === $data && 'null' !== $content) {
  16391. self::validateSyntax($content, $this->path);
  16392. }
  16393. if (null === $schemaFile) {
  16394. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  16395. }
  16396. if (false === strpos($schemaFile, '://')) {
  16397. $schemaFile = 'file://' . $schemaFile;
  16398. }
  16399. $schemaData = (object) array('$ref' => $schemaFile);
  16400. if ($schema === self::LAX_SCHEMA) {
  16401. $schemaData->additionalProperties = true;
  16402. $schemaData->required = array();
  16403. }
  16404. $validator = new Validator();
  16405. $validator->check($data, $schemaData);
  16406. if (!$validator->isValid()) {
  16407. $errors = array();
  16408. foreach ((array) $validator->getErrors() as $error) {
  16409. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  16410. }
  16411. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  16412. }
  16413. return true;
  16414. }
  16415. public static function encode($data, $options = 448)
  16416. {
  16417. if (PHP_VERSION_ID >= 50400) {
  16418. $json = json_encode($data, $options);
  16419. if (false === $json) {
  16420. self::throwEncodeError(json_last_error());
  16421. }
  16422. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  16423. $json = preg_replace('/\[\s+\]/', '[]', $json);
  16424. $json = preg_replace('/\{\s+\}/', '{}', $json);
  16425. }
  16426. return $json;
  16427. }
  16428. $json = json_encode($data);
  16429. if (false === $json) {
  16430. self::throwEncodeError(json_last_error());
  16431. }
  16432. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  16433. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  16434. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  16435. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  16436. return $json;
  16437. }
  16438. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  16439. }
  16440. private static function throwEncodeError($code)
  16441. {
  16442. switch ($code) {
  16443. case JSON_ERROR_DEPTH:
  16444. $msg = 'Maximum stack depth exceeded';
  16445. break;
  16446. case JSON_ERROR_STATE_MISMATCH:
  16447. $msg = 'Underflow or the modes mismatch';
  16448. break;
  16449. case JSON_ERROR_CTRL_CHAR:
  16450. $msg = 'Unexpected control character found';
  16451. break;
  16452. case JSON_ERROR_UTF8:
  16453. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  16454. break;
  16455. default:
  16456. $msg = 'Unknown error';
  16457. }
  16458. throw new \RuntimeException('JSON encoding failed: '.$msg);
  16459. }
  16460. public static function parseJson($json, $file = null)
  16461. {
  16462. if (null === $json) {
  16463. return;
  16464. }
  16465. $data = json_decode($json, true);
  16466. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  16467. self::validateSyntax($json, $file);
  16468. }
  16469. return $data;
  16470. }
  16471. protected static function validateSyntax($json, $file = null)
  16472. {
  16473. $parser = new JsonParser();
  16474. $result = $parser->lint($json);
  16475. if (null === $result) {
  16476. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  16477. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  16478. }
  16479. return true;
  16480. }
  16481. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  16482. }
  16483. }
  16484. <?php
  16485. namespace Composer\Json;
  16486. class JsonFormatter
  16487. {
  16488. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  16489. {
  16490. $result = '';
  16491. $pos = 0;
  16492. $strLen = strlen($json);
  16493. $indentStr = ' ';
  16494. $newLine = "\n";
  16495. $outOfQuotes = true;
  16496. $buffer = '';
  16497. $noescape = true;
  16498. for ($i = 0; $i < $strLen; $i++) {
  16499. $char = substr($json, $i, 1);
  16500. if ('"' === $char && $noescape) {
  16501. $outOfQuotes = !$outOfQuotes;
  16502. }
  16503. if (!$outOfQuotes) {
  16504. $buffer .= $char;
  16505. $noescape = '\\' === $char ? !$noescape : true;
  16506. continue;
  16507. } elseif ('' !== $buffer) {
  16508. if ($unescapeSlashes) {
  16509. $buffer = str_replace('\\/', '/', $buffer);
  16510. }
  16511. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  16512. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  16513. $l = strlen($match[1]);
  16514. if ($l % 2) {
  16515. $code = hexdec($match[2]);
  16516. if (0xD800 <= $code && 0xDFFF >= $code) {
  16517. return $match[0];
  16518. }
  16519. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  16520. pack('H*', $match[2]),
  16521. 'UTF-8',
  16522. 'UCS-2BE'
  16523. );
  16524. }
  16525. return $match[0];
  16526. }, $buffer);
  16527. }
  16528. $result .= $buffer.$char;
  16529. $buffer = '';
  16530. continue;
  16531. }
  16532. if (':' === $char) {
  16533. $char .= ' ';
  16534. } elseif ('}' === $char || ']' === $char) {
  16535. $pos--;
  16536. $prevChar = substr($json, $i - 1, 1);
  16537. if ('{' !== $prevChar && '[' !== $prevChar) {
  16538. $result .= $newLine;
  16539. for ($j = 0; $j < $pos; $j++) {
  16540. $result .= $indentStr;
  16541. }
  16542. } else {
  16543. $result = rtrim($result);
  16544. }
  16545. }
  16546. $result .= $char;
  16547. if (',' === $char || '{' === $char || '[' === $char) {
  16548. $result .= $newLine;
  16549. if ('{' === $char || '[' === $char) {
  16550. $pos++;
  16551. }
  16552. for ($j = 0; $j < $pos; $j++) {
  16553. $result .= $indentStr;
  16554. }
  16555. }
  16556. }
  16557. return $result;
  16558. }
  16559. }
  16560. <?php
  16561. namespace Composer\Json;
  16562. use Composer\Repository\PlatformRepository;
  16563. class JsonManipulator
  16564. {
  16565. private static $DEFINES = '(?(DEFINE)
  16566. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  16567. (?<boolean> true | false | null )
  16568. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  16569. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  16570. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  16571. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  16572. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  16573. )';
  16574. private $contents;
  16575. private $newline;
  16576. private $indent;
  16577. public function __construct($contents)
  16578. {
  16579. $contents = trim($contents);
  16580. if ($contents === '') {
  16581. $contents = '{}';
  16582. }
  16583. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  16584. throw new \InvalidArgumentException('The json file must be an object ({})');
  16585. }
  16586. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  16587. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  16588. $this->detectIndenting();
  16589. }
  16590. public function getContents()
  16591. {
  16592. return $this->contents . $this->newline;
  16593. }
  16594. public function addLink($type, $package, $constraint, $sortPackages = false)
  16595. {
  16596. $decoded = JsonFile::parseJson($this->contents);
  16597. if (!isset($decoded[$type])) {
  16598. return $this->addMainKey($type, array($package => $constraint));
  16599. }
  16600. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16601. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  16602. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  16603. return false;
  16604. }
  16605. $links = $matches['value'];
  16606. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  16607. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  16608. if ($this->pregMatch($regex, $links, $packageMatches)) {
  16609. $existingPackage = $packageMatches['package'];
  16610. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  16611. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  16612. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  16613. }, $links);
  16614. } else {
  16615. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  16616. $links = preg_replace(
  16617. '{'.preg_quote($match[1]).'$}',
  16618. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  16619. $links
  16620. );
  16621. } else {
  16622. $links = '{' . $this->newline .
  16623. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  16624. $this->indent . '}';
  16625. }
  16626. }
  16627. if (true === $sortPackages) {
  16628. $requirements = json_decode($links, true);
  16629. $this->sortPackages($requirements);
  16630. $links = $this->format($requirements);
  16631. }
  16632. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  16633. return true;
  16634. }
  16635. private function sortPackages(array &$packages = array())
  16636. {
  16637. $prefix = function ($requirement) {
  16638. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  16639. return preg_replace(
  16640. array(
  16641. '/^php/',
  16642. '/^hhvm/',
  16643. '/^ext/',
  16644. '/^lib/',
  16645. '/^\D/',
  16646. ),
  16647. array(
  16648. '0-$0',
  16649. '1-$0',
  16650. '2-$0',
  16651. '3-$0',
  16652. '4-$0',
  16653. ),
  16654. $requirement
  16655. );
  16656. }
  16657. return '5-'.$requirement;
  16658. };
  16659. uksort($packages, function ($a, $b) use ($prefix) {
  16660. return strnatcmp($prefix($a), $prefix($b));
  16661. });
  16662. }
  16663. public function addRepository($name, $config)
  16664. {
  16665. return $this->addSubNode('repositories', $name, $config);
  16666. }
  16667. public function removeRepository($name)
  16668. {
  16669. return $this->removeSubNode('repositories', $name);
  16670. }
  16671. public function addConfigSetting($name, $value)
  16672. {
  16673. return $this->addSubNode('config', $name, $value);
  16674. }
  16675. public function removeConfigSetting($name)
  16676. {
  16677. return $this->removeSubNode('config', $name);
  16678. }
  16679. public function addProperty($name, $value)
  16680. {
  16681. if (substr($name, 0, 8) === 'suggest.') {
  16682. return $this->addSubNode('suggest', substr($name, 8), $value);
  16683. }
  16684. if (substr($name, 0, 6) === 'extra.') {
  16685. return $this->addSubNode('extra', substr($name, 6), $value);
  16686. }
  16687. if (substr($name, 0, 8) === 'scripts.') {
  16688. return $this->addSubNode('scripts', substr($name, 8), $value);
  16689. }
  16690. return $this->addMainKey($name, $value);
  16691. }
  16692. public function removeProperty($name)
  16693. {
  16694. if (substr($name, 0, 8) === 'suggest.') {
  16695. return $this->removeSubNode('suggest', substr($name, 8));
  16696. }
  16697. if (substr($name, 0, 6) === 'extra.') {
  16698. return $this->removeSubNode('extra', substr($name, 6));
  16699. }
  16700. if (substr($name, 0, 8) === 'scripts.') {
  16701. return $this->removeSubNode('scripts', substr($name, 8));
  16702. }
  16703. return $this->removeMainKey($name);
  16704. }
  16705. public function addSubNode($mainNode, $name, $value)
  16706. {
  16707. $decoded = JsonFile::parseJson($this->contents);
  16708. $subName = null;
  16709. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16710. list($name, $subName) = explode('.', $name, 2);
  16711. }
  16712. if (!isset($decoded[$mainNode])) {
  16713. if ($subName !== null) {
  16714. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16715. } else {
  16716. $this->addMainKey($mainNode, array($name => $value));
  16717. }
  16718. return true;
  16719. }
  16720. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16721. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16722. try {
  16723. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16724. return false;
  16725. }
  16726. } catch (\RuntimeException $e) {
  16727. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16728. return false;
  16729. }
  16730. throw $e;
  16731. }
  16732. $children = $match['content'];
  16733. if (!@json_decode($children)) {
  16734. return false;
  16735. }
  16736. $that = $this;
  16737. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16738. if ($this->pregMatch($childRegex, $children, $matches)) {
  16739. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16740. if ($subName !== null) {
  16741. $curVal = json_decode($matches['content'], true);
  16742. if (!is_array($curVal)) {
  16743. $curVal = array();
  16744. }
  16745. $curVal[$subName] = $value;
  16746. $value = $curVal;
  16747. }
  16748. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16749. }, $children);
  16750. } else {
  16751. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16752. $whitespace = '';
  16753. if (!empty($match['trailingspace'])) {
  16754. $whitespace = $match['trailingspace'];
  16755. }
  16756. if (!empty($match['content'])) {
  16757. if ($subName !== null) {
  16758. $value = array($subName => $value);
  16759. }
  16760. $children = preg_replace(
  16761. '#'.$whitespace.'}$#',
  16762. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16763. $children
  16764. );
  16765. } else {
  16766. if ($subName !== null) {
  16767. $value = array($subName => $value);
  16768. }
  16769. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16770. }
  16771. }
  16772. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16773. return $m['start'] . $children . $m['end'];
  16774. }, $this->contents);
  16775. return true;
  16776. }
  16777. public function removeSubNode($mainNode, $name)
  16778. {
  16779. $decoded = JsonFile::parseJson($this->contents);
  16780. if (empty($decoded[$mainNode])) {
  16781. return true;
  16782. }
  16783. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16784. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16785. try {
  16786. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16787. return false;
  16788. }
  16789. } catch (\RuntimeException $e) {
  16790. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16791. return false;
  16792. }
  16793. throw $e;
  16794. }
  16795. $children = $match['content'];
  16796. if (!@json_decode($children, true)) {
  16797. return false;
  16798. }
  16799. $subName = null;
  16800. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16801. list($name, $subName) = explode('.', $name, 2);
  16802. }
  16803. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16804. return true;
  16805. }
  16806. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16807. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16808. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16809. $bestMatch = '';
  16810. foreach ($matches[0] as $match) {
  16811. if (strlen($bestMatch) < strlen($match)) {
  16812. $bestMatch = $match;
  16813. }
  16814. }
  16815. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16816. if (1 !== $count) {
  16817. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16818. if (1 !== $count) {
  16819. return false;
  16820. }
  16821. }
  16822. }
  16823. } else {
  16824. $childrenClean = $children;
  16825. }
  16826. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16827. if (empty($match['content'])) {
  16828. $newline = $this->newline;
  16829. $indent = $this->indent;
  16830. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16831. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16832. }, $this->contents);
  16833. if ($subName !== null) {
  16834. $curVal = json_decode($children, true);
  16835. unset($curVal[$name][$subName]);
  16836. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16837. }
  16838. return true;
  16839. }
  16840. $that = $this;
  16841. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16842. if ($subName !== null) {
  16843. $curVal = json_decode($matches['content'], true);
  16844. unset($curVal[$name][$subName]);
  16845. $childrenClean = $that->format($curVal, 0);
  16846. }
  16847. return $matches['start'] . $childrenClean . $matches['end'];
  16848. }, $this->contents);
  16849. return true;
  16850. }
  16851. public function addMainKey($key, $content)
  16852. {
  16853. $decoded = JsonFile::parseJson($this->contents);
  16854. $content = $this->format($content);
  16855. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16856. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16857. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16858. if (!@json_decode('{'.$matches['key'].'}')) {
  16859. return false;
  16860. }
  16861. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16862. return true;
  16863. }
  16864. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16865. $this->contents = preg_replace(
  16866. '#'.$match[1].'\}$#',
  16867. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16868. $this->contents
  16869. );
  16870. return true;
  16871. }
  16872. $this->contents = preg_replace(
  16873. '#\}$#',
  16874. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16875. $this->contents
  16876. );
  16877. return true;
  16878. }
  16879. public function removeMainKey($key)
  16880. {
  16881. $decoded = JsonFile::parseJson($this->contents);
  16882. if (!array_key_exists($key, $decoded)) {
  16883. return true;
  16884. }
  16885. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16886. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16887. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16888. if (!@json_decode('{'.$matches['removal'].'}')) {
  16889. return false;
  16890. }
  16891. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16892. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16893. }
  16894. $this->contents = $matches['start'] . $matches['end'];
  16895. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16896. $this->contents = "{\n}";
  16897. }
  16898. return true;
  16899. }
  16900. return false;
  16901. }
  16902. public function format($data, $depth = 0)
  16903. {
  16904. if (is_array($data)) {
  16905. reset($data);
  16906. if (is_numeric(key($data))) {
  16907. foreach ($data as $key => $val) {
  16908. $data[$key] = $this->format($val, $depth + 1);
  16909. }
  16910. return '['.implode(', ', $data).']';
  16911. }
  16912. $out = '{' . $this->newline;
  16913. $elems = array();
  16914. foreach ($data as $key => $val) {
  16915. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16916. }
  16917. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16918. }
  16919. return JsonFile::encode($data);
  16920. }
  16921. protected function detectIndenting()
  16922. {
  16923. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16924. $this->indent = $match[1];
  16925. } else {
  16926. $this->indent = ' ';
  16927. }
  16928. }
  16929. protected function pregMatch($re, $str, &$matches = array())
  16930. {
  16931. $count = preg_match($re, $str, $matches);
  16932. if ($count === false) {
  16933. switch (preg_last_error()) {
  16934. case PREG_NO_ERROR:
  16935. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16936. case PREG_INTERNAL_ERROR:
  16937. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16938. case PREG_BACKTRACK_LIMIT_ERROR:
  16939. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16940. case PREG_RECURSION_LIMIT_ERROR:
  16941. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16942. case PREG_BAD_UTF8_ERROR:
  16943. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16944. case PREG_BAD_UTF8_OFFSET_ERROR:
  16945. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16946. case 6:
  16947. if (PHP_VERSION_ID > 70000) {
  16948. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16949. }
  16950. default:
  16951. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16952. }
  16953. }
  16954. return $count;
  16955. }
  16956. }
  16957. <?php
  16958. namespace Composer\Json;
  16959. use Exception;
  16960. class JsonValidationException extends Exception
  16961. {
  16962. protected $errors;
  16963. public function __construct($message, $errors = array(), Exception $previous = null)
  16964. {
  16965. $this->errors = $errors;
  16966. parent::__construct($message, 0, $previous);
  16967. }
  16968. public function getErrors()
  16969. {
  16970. return $this->errors;
  16971. }
  16972. }
  16973. <?php
  16974. namespace Composer\Package;
  16975. use Composer\Semver\Constraint\Constraint;
  16976. use Composer\Package\Version\VersionParser;
  16977. class AliasPackage extends BasePackage implements CompletePackageInterface
  16978. {
  16979. protected $version;
  16980. protected $prettyVersion;
  16981. protected $dev;
  16982. protected $rootPackageAlias = false;
  16983. protected $stability;
  16984. protected $aliasOf;
  16985. protected $requires;
  16986. protected $devRequires;
  16987. protected $conflicts;
  16988. protected $provides;
  16989. protected $replaces;
  16990. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16991. {
  16992. parent::__construct($aliasOf->getName());
  16993. $this->version = $version;
  16994. $this->prettyVersion = $prettyVersion;
  16995. $this->aliasOf = $aliasOf;
  16996. $this->stability = VersionParser::parseStability($version);
  16997. $this->dev = $this->stability === 'dev';
  16998. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16999. $links = $aliasOf->{'get' . ucfirst($type)}();
  17000. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  17001. }
  17002. }
  17003. public function getAliasOf()
  17004. {
  17005. return $this->aliasOf;
  17006. }
  17007. public function getVersion()
  17008. {
  17009. return $this->version;
  17010. }
  17011. public function getStability()
  17012. {
  17013. return $this->stability;
  17014. }
  17015. public function getPrettyVersion()
  17016. {
  17017. return $this->prettyVersion;
  17018. }
  17019. public function isDev()
  17020. {
  17021. return $this->dev;
  17022. }
  17023. public function getRequires()
  17024. {
  17025. return $this->requires;
  17026. }
  17027. public function getConflicts()
  17028. {
  17029. return $this->conflicts;
  17030. }
  17031. public function getProvides()
  17032. {
  17033. return $this->provides;
  17034. }
  17035. public function getReplaces()
  17036. {
  17037. return $this->replaces;
  17038. }
  17039. public function getDevRequires()
  17040. {
  17041. return $this->devRequires;
  17042. }
  17043. public function setRootPackageAlias($value)
  17044. {
  17045. return $this->rootPackageAlias = $value;
  17046. }
  17047. public function isRootPackageAlias()
  17048. {
  17049. return $this->rootPackageAlias;
  17050. }
  17051. protected function replaceSelfVersionDependencies(array $links, $linkType)
  17052. {
  17053. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  17054. $newLinks = array();
  17055. foreach ($links as $link) {
  17056. if ('self.version' === $link->getPrettyConstraint()) {
  17057. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17058. }
  17059. }
  17060. $links = array_merge($links, $newLinks);
  17061. } else {
  17062. foreach ($links as $index => $link) {
  17063. if ('self.version' === $link->getPrettyConstraint()) {
  17064. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17065. }
  17066. }
  17067. }
  17068. return $links;
  17069. }
  17070. public function getType()
  17071. {
  17072. return $this->aliasOf->getType();
  17073. }
  17074. public function getTargetDir()
  17075. {
  17076. return $this->aliasOf->getTargetDir();
  17077. }
  17078. public function getExtra()
  17079. {
  17080. return $this->aliasOf->getExtra();
  17081. }
  17082. public function setInstallationSource($type)
  17083. {
  17084. $this->aliasOf->setInstallationSource($type);
  17085. }
  17086. public function getInstallationSource()
  17087. {
  17088. return $this->aliasOf->getInstallationSource();
  17089. }
  17090. public function getSourceType()
  17091. {
  17092. return $this->aliasOf->getSourceType();
  17093. }
  17094. public function getSourceUrl()
  17095. {
  17096. return $this->aliasOf->getSourceUrl();
  17097. }
  17098. public function getSourceUrls()
  17099. {
  17100. return $this->aliasOf->getSourceUrls();
  17101. }
  17102. public function getSourceReference()
  17103. {
  17104. return $this->aliasOf->getSourceReference();
  17105. }
  17106. public function setSourceReference($reference)
  17107. {
  17108. return $this->aliasOf->setSourceReference($reference);
  17109. }
  17110. public function setSourceMirrors($mirrors)
  17111. {
  17112. return $this->aliasOf->setSourceMirrors($mirrors);
  17113. }
  17114. public function getSourceMirrors()
  17115. {
  17116. return $this->aliasOf->getSourceMirrors();
  17117. }
  17118. public function getDistType()
  17119. {
  17120. return $this->aliasOf->getDistType();
  17121. }
  17122. public function getDistUrl()
  17123. {
  17124. return $this->aliasOf->getDistUrl();
  17125. }
  17126. public function getDistUrls()
  17127. {
  17128. return $this->aliasOf->getDistUrls();
  17129. }
  17130. public function getDistReference()
  17131. {
  17132. return $this->aliasOf->getDistReference();
  17133. }
  17134. public function setDistReference($reference)
  17135. {
  17136. return $this->aliasOf->setDistReference($reference);
  17137. }
  17138. public function getDistSha1Checksum()
  17139. {
  17140. return $this->aliasOf->getDistSha1Checksum();
  17141. }
  17142. public function setTransportOptions(array $options)
  17143. {
  17144. return $this->aliasOf->setTransportOptions($options);
  17145. }
  17146. public function getTransportOptions()
  17147. {
  17148. return $this->aliasOf->getTransportOptions();
  17149. }
  17150. public function setDistMirrors($mirrors)
  17151. {
  17152. return $this->aliasOf->setDistMirrors($mirrors);
  17153. }
  17154. public function getDistMirrors()
  17155. {
  17156. return $this->aliasOf->getDistMirrors();
  17157. }
  17158. public function getScripts()
  17159. {
  17160. return $this->aliasOf->getScripts();
  17161. }
  17162. public function getLicense()
  17163. {
  17164. return $this->aliasOf->getLicense();
  17165. }
  17166. public function getAutoload()
  17167. {
  17168. return $this->aliasOf->getAutoload();
  17169. }
  17170. public function getDevAutoload()
  17171. {
  17172. return $this->aliasOf->getDevAutoload();
  17173. }
  17174. public function getIncludePaths()
  17175. {
  17176. return $this->aliasOf->getIncludePaths();
  17177. }
  17178. public function getRepositories()
  17179. {
  17180. return $this->aliasOf->getRepositories();
  17181. }
  17182. public function getReleaseDate()
  17183. {
  17184. return $this->aliasOf->getReleaseDate();
  17185. }
  17186. public function getBinaries()
  17187. {
  17188. return $this->aliasOf->getBinaries();
  17189. }
  17190. public function getKeywords()
  17191. {
  17192. return $this->aliasOf->getKeywords();
  17193. }
  17194. public function getDescription()
  17195. {
  17196. return $this->aliasOf->getDescription();
  17197. }
  17198. public function getHomepage()
  17199. {
  17200. return $this->aliasOf->getHomepage();
  17201. }
  17202. public function getSuggests()
  17203. {
  17204. return $this->aliasOf->getSuggests();
  17205. }
  17206. public function getAuthors()
  17207. {
  17208. return $this->aliasOf->getAuthors();
  17209. }
  17210. public function getSupport()
  17211. {
  17212. return $this->aliasOf->getSupport();
  17213. }
  17214. public function getFunding()
  17215. {
  17216. return $this->aliasOf->getFunding();
  17217. }
  17218. public function getNotificationUrl()
  17219. {
  17220. return $this->aliasOf->getNotificationUrl();
  17221. }
  17222. public function getArchiveExcludes()
  17223. {
  17224. return $this->aliasOf->getArchiveExcludes();
  17225. }
  17226. public function isAbandoned()
  17227. {
  17228. return $this->aliasOf->isAbandoned();
  17229. }
  17230. public function getReplacementPackage()
  17231. {
  17232. return $this->aliasOf->getReplacementPackage();
  17233. }
  17234. public function __toString()
  17235. {
  17236. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  17237. }
  17238. public function setDistUrl($url)
  17239. {
  17240. return $this->aliasOf->setDistUrl($url);
  17241. }
  17242. public function setDistType($type)
  17243. {
  17244. return $this->aliasOf->setDistType($type);
  17245. }
  17246. }
  17247. <?php
  17248. namespace Composer\Package\Archiver;
  17249. use FilterIterator;
  17250. use PharData;
  17251. class ArchivableFilesFilter extends FilterIterator
  17252. {
  17253. private $dirs = array();
  17254. public function accept()
  17255. {
  17256. $file = $this->getInnerIterator()->current();
  17257. if ($file->isDir()) {
  17258. $this->dirs[] = (string) $file;
  17259. return false;
  17260. }
  17261. return true;
  17262. }
  17263. public function addEmptyDir(PharData $phar, $sources)
  17264. {
  17265. foreach ($this->dirs as $filepath) {
  17266. $localname = str_replace($sources . "/", '', $filepath);
  17267. $phar->addEmptyDir($localname);
  17268. }
  17269. }
  17270. }
  17271. <?php
  17272. namespace Composer\Package\Archiver;
  17273. use Composer\Util\Filesystem;
  17274. use FilesystemIterator;
  17275. use Symfony\Component\Finder\Finder;
  17276. use Symfony\Component\Finder\SplFileInfo;
  17277. class ArchivableFilesFinder extends \FilterIterator
  17278. {
  17279. protected $finder;
  17280. public function __construct($sources, array $excludes, $ignoreFilters = false)
  17281. {
  17282. $fs = new Filesystem();
  17283. $sources = $fs->normalizePath($sources);
  17284. if ($ignoreFilters) {
  17285. $filters = array();
  17286. } else {
  17287. $filters = array(
  17288. new HgExcludeFilter($sources),
  17289. new GitExcludeFilter($sources),
  17290. new ComposerExcludeFilter($sources, $excludes),
  17291. );
  17292. }
  17293. $this->finder = new Finder();
  17294. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  17295. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  17296. return false;
  17297. }
  17298. $relativePath = preg_replace(
  17299. '#^'.preg_quote($sources, '#').'#',
  17300. '',
  17301. $fs->normalizePath($file->getRealPath())
  17302. );
  17303. $exclude = false;
  17304. foreach ($filters as $filter) {
  17305. $exclude = $filter->filter($relativePath, $exclude);
  17306. }
  17307. return !$exclude;
  17308. };
  17309. if (method_exists($filter, 'bindTo')) {
  17310. $filter = $filter->bindTo(null);
  17311. }
  17312. $this->finder
  17313. ->in($sources)
  17314. ->filter($filter)
  17315. ->ignoreVCS(true)
  17316. ->ignoreDotFiles(false);
  17317. parent::__construct($this->finder->getIterator());
  17318. }
  17319. public function accept()
  17320. {
  17321. $current = $this->getInnerIterator()->current();
  17322. if (!$current->isDir()) {
  17323. return true;
  17324. }
  17325. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  17326. return !$iterator->valid();
  17327. }
  17328. }
  17329. <?php
  17330. namespace Composer\Package\Archiver;
  17331. use Composer\Downloader\DownloadManager;
  17332. use Composer\Package\PackageInterface;
  17333. use Composer\Package\RootPackageInterface;
  17334. use Composer\Util\Filesystem;
  17335. use Composer\Json\JsonFile;
  17336. class ArchiveManager
  17337. {
  17338. protected $downloadManager;
  17339. protected $archivers = array();
  17340. protected $overwriteFiles = true;
  17341. public function __construct(DownloadManager $downloadManager)
  17342. {
  17343. $this->downloadManager = $downloadManager;
  17344. }
  17345. public function addArchiver(ArchiverInterface $archiver)
  17346. {
  17347. $this->archivers[] = $archiver;
  17348. }
  17349. public function setOverwriteFiles($overwriteFiles)
  17350. {
  17351. $this->overwriteFiles = $overwriteFiles;
  17352. return $this;
  17353. }
  17354. public function getPackageFilename(PackageInterface $package)
  17355. {
  17356. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  17357. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  17358. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  17359. } else {
  17360. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  17361. }
  17362. if ($package->getSourceReference()) {
  17363. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  17364. }
  17365. $name = implode('-', array_filter($nameParts, function ($p) {
  17366. return !empty($p);
  17367. }));
  17368. return str_replace('/', '-', $name);
  17369. }
  17370. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  17371. {
  17372. if (empty($format)) {
  17373. throw new \InvalidArgumentException('Format must be specified');
  17374. }
  17375. $usableArchiver = null;
  17376. foreach ($this->archivers as $archiver) {
  17377. if ($archiver->supports($format, $package->getSourceType())) {
  17378. $usableArchiver = $archiver;
  17379. break;
  17380. }
  17381. }
  17382. if (null === $usableArchiver) {
  17383. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  17384. }
  17385. $filesystem = new Filesystem();
  17386. if (null === $fileName) {
  17387. $packageName = $this->getPackageFilename($package);
  17388. } else {
  17389. $packageName = $fileName;
  17390. }
  17391. $filesystem->ensureDirectoryExists($targetDir);
  17392. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  17393. $filesystem->ensureDirectoryExists(dirname($target));
  17394. if (!$this->overwriteFiles && file_exists($target)) {
  17395. return $target;
  17396. }
  17397. if ($package instanceof RootPackageInterface) {
  17398. $sourcePath = realpath('.');
  17399. } else {
  17400. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  17401. $filesystem->ensureDirectoryExists($sourcePath);
  17402. try {
  17403. $this->downloadManager->download($package, $sourcePath);
  17404. } catch (\Exception $e) {
  17405. $filesystem->removeDirectory($sourcePath);
  17406. throw $e;
  17407. }
  17408. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  17409. $jsonFile = new JsonFile($composerJsonPath);
  17410. $jsonData = $jsonFile->read();
  17411. if (!empty($jsonData['archive']['exclude'])) {
  17412. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  17413. }
  17414. }
  17415. }
  17416. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  17417. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  17418. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  17419. $filesystem->rename($archivePath, $target);
  17420. if (!$package instanceof RootPackageInterface) {
  17421. $filesystem->removeDirectory($sourcePath);
  17422. }
  17423. $filesystem->remove($tempTarget);
  17424. return $target;
  17425. }
  17426. }
  17427. <?php
  17428. namespace Composer\Package\Archiver;
  17429. interface ArchiverInterface
  17430. {
  17431. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  17432. public function supports($format, $sourceType);
  17433. }
  17434. <?php
  17435. namespace Composer\Package\Archiver;
  17436. use Symfony\Component\Finder;
  17437. abstract class BaseExcludeFilter
  17438. {
  17439. protected $sourcePath;
  17440. protected $excludePatterns;
  17441. public function __construct($sourcePath)
  17442. {
  17443. $this->sourcePath = $sourcePath;
  17444. $this->excludePatterns = array();
  17445. }
  17446. public function filter($relativePath, $exclude)
  17447. {
  17448. foreach ($this->excludePatterns as $patternData) {
  17449. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  17450. if ($stripLeadingSlash) {
  17451. $path = substr($relativePath, 1);
  17452. } else {
  17453. $path = $relativePath;
  17454. }
  17455. if (preg_match($pattern, $path)) {
  17456. $exclude = !$negate;
  17457. }
  17458. }
  17459. return $exclude;
  17460. }
  17461. protected function parseLines(array $lines, $lineParser)
  17462. {
  17463. return array_filter(
  17464. array_map(
  17465. function ($line) use ($lineParser) {
  17466. $line = trim($line);
  17467. if (!$line || 0 === strpos($line, '#')) {
  17468. return null;
  17469. }
  17470. return call_user_func($lineParser, $line);
  17471. },
  17472. $lines
  17473. ),
  17474. function ($pattern) {
  17475. return $pattern !== null;
  17476. }
  17477. );
  17478. }
  17479. protected function generatePatterns($rules)
  17480. {
  17481. $patterns = array();
  17482. foreach ($rules as $rule) {
  17483. $patterns[] = $this->generatePattern($rule);
  17484. }
  17485. return $patterns;
  17486. }
  17487. protected function generatePattern($rule)
  17488. {
  17489. $negate = false;
  17490. $pattern = '{';
  17491. if (strlen($rule) && $rule[0] === '!') {
  17492. $negate = true;
  17493. $rule = substr($rule, 1);
  17494. }
  17495. if (strlen($rule) && $rule[0] === '/') {
  17496. $pattern .= '^/';
  17497. $rule = substr($rule, 1);
  17498. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  17499. $pattern .= '/';
  17500. $rule = substr($rule, 0, -1);
  17501. } elseif (false === strpos($rule, '/')) {
  17502. $pattern .= '/';
  17503. }
  17504. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  17505. return array($pattern . '}', $negate, false);
  17506. }
  17507. }
  17508. <?php
  17509. namespace Composer\Package\Archiver;
  17510. class ComposerExcludeFilter extends BaseExcludeFilter
  17511. {
  17512. public function __construct($sourcePath, array $excludeRules)
  17513. {
  17514. parent::__construct($sourcePath);
  17515. $this->excludePatterns = $this->generatePatterns($excludeRules);
  17516. }
  17517. }
  17518. <?php
  17519. namespace Composer\Package\Archiver;
  17520. class GitExcludeFilter extends BaseExcludeFilter
  17521. {
  17522. public function __construct($sourcePath)
  17523. {
  17524. parent::__construct($sourcePath);
  17525. if (file_exists($sourcePath.'/.gitignore')) {
  17526. $this->excludePatterns = $this->parseLines(
  17527. file($sourcePath.'/.gitignore'),
  17528. array($this, 'parseGitIgnoreLine')
  17529. );
  17530. }
  17531. if (file_exists($sourcePath.'/.gitattributes')) {
  17532. $this->excludePatterns = array_merge(
  17533. $this->excludePatterns,
  17534. $this->parseLines(
  17535. file($sourcePath.'/.gitattributes'),
  17536. array($this, 'parseGitAttributesLine')
  17537. )
  17538. );
  17539. }
  17540. }
  17541. public function parseGitIgnoreLine($line)
  17542. {
  17543. return $this->generatePattern($line);
  17544. }
  17545. public function parseGitAttributesLine($line)
  17546. {
  17547. $parts = preg_split('#\s+#', $line);
  17548. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  17549. return $this->generatePattern($parts[0]);
  17550. }
  17551. return null;
  17552. }
  17553. }
  17554. <?php
  17555. namespace Composer\Package\Archiver;
  17556. use Symfony\Component\Finder;
  17557. class HgExcludeFilter extends BaseExcludeFilter
  17558. {
  17559. const HG_IGNORE_REGEX = 1;
  17560. const HG_IGNORE_GLOB = 2;
  17561. protected $patternMode;
  17562. public function __construct($sourcePath)
  17563. {
  17564. parent::__construct($sourcePath);
  17565. $this->patternMode = self::HG_IGNORE_REGEX;
  17566. if (file_exists($sourcePath.'/.hgignore')) {
  17567. $this->excludePatterns = $this->parseLines(
  17568. file($sourcePath.'/.hgignore'),
  17569. array($this, 'parseHgIgnoreLine')
  17570. );
  17571. }
  17572. }
  17573. public function parseHgIgnoreLine($line)
  17574. {
  17575. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  17576. if ($matches[1] === 'glob') {
  17577. $this->patternMode = self::HG_IGNORE_GLOB;
  17578. } else {
  17579. $this->patternMode = self::HG_IGNORE_REGEX;
  17580. }
  17581. return null;
  17582. }
  17583. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  17584. return $this->patternFromGlob($line);
  17585. }
  17586. return $this->patternFromRegex($line);
  17587. }
  17588. protected function patternFromGlob($line)
  17589. {
  17590. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  17591. $pattern = str_replace('[^/]*', '.*', $pattern);
  17592. return array($pattern, false, true);
  17593. }
  17594. public function patternFromRegex($line)
  17595. {
  17596. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  17597. return array($pattern, false, true);
  17598. }
  17599. }
  17600. <?php
  17601. namespace Composer\Package\Archiver;
  17602. class PharArchiver implements ArchiverInterface
  17603. {
  17604. protected static $formats = array(
  17605. 'zip' => \Phar::ZIP,
  17606. 'tar' => \Phar::TAR,
  17607. 'tar.gz' => \Phar::TAR,
  17608. 'tar.bz2' => \Phar::TAR,
  17609. );
  17610. protected static $compressFormats = array(
  17611. 'tar.gz' => \Phar::GZ,
  17612. 'tar.bz2' => \Phar::BZ2,
  17613. );
  17614. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17615. {
  17616. $sources = realpath($sources);
  17617. if (file_exists($target)) {
  17618. unlink($target);
  17619. }
  17620. try {
  17621. $filename = substr($target, 0, strrpos($target, $format) - 1);
  17622. if (isset(static::$compressFormats[$format])) {
  17623. $target = $filename . '.tar';
  17624. }
  17625. $phar = new \PharData($target, null, null, static::$formats[$format]);
  17626. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17627. $filesOnly = new ArchivableFilesFilter($files);
  17628. $phar->buildFromIterator($filesOnly, $sources);
  17629. $filesOnly->addEmptyDir($phar, $sources);
  17630. if (isset(static::$compressFormats[$format])) {
  17631. if (!$phar->canCompress(static::$compressFormats[$format])) {
  17632. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  17633. }
  17634. unlink($target);
  17635. $phar->compress(static::$compressFormats[$format]);
  17636. $target = $filename . '.' . $format;
  17637. }
  17638. return $target;
  17639. } catch (\UnexpectedValueException $e) {
  17640. $message = sprintf(
  17641. "Could not create archive '%s' from '%s': %s",
  17642. $target,
  17643. $sources,
  17644. $e->getMessage()
  17645. );
  17646. throw new \RuntimeException($message, $e->getCode(), $e);
  17647. }
  17648. }
  17649. public function supports($format, $sourceType)
  17650. {
  17651. return isset(static::$formats[$format]);
  17652. }
  17653. }
  17654. <?php
  17655. namespace Composer\Package\Archiver;
  17656. use ZipArchive;
  17657. use Composer\Util\Filesystem;
  17658. class ZipArchiver implements ArchiverInterface
  17659. {
  17660. protected static $formats = array(
  17661. 'zip' => 1,
  17662. );
  17663. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17664. {
  17665. $fs = new Filesystem();
  17666. $sources = $fs->normalizePath($sources);
  17667. $zip = new ZipArchive();
  17668. $res = $zip->open($target, ZipArchive::CREATE);
  17669. if ($res === true) {
  17670. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17671. foreach ($files as $file) {
  17672. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  17673. $localname = str_replace($sources.'/', '', $filepath);
  17674. if ($file->isDir()) {
  17675. $zip->addEmptyDir($localname);
  17676. } else {
  17677. $zip->addFile($filepath, $localname);
  17678. }
  17679. if (PHP_VERSION_ID >= 50600) {
  17680. $perms = fileperms($filepath);
  17681. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  17682. }
  17683. }
  17684. if ($zip->close()) {
  17685. return $target;
  17686. }
  17687. }
  17688. $message = sprintf(
  17689. "Could not create archive '%s' from '%s': %s",
  17690. $target,
  17691. $sources,
  17692. $zip->getStatusString()
  17693. );
  17694. throw new \RuntimeException($message);
  17695. }
  17696. public function supports($format, $sourceType)
  17697. {
  17698. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17699. }
  17700. private function compressionAvailable()
  17701. {
  17702. return class_exists('ZipArchive');
  17703. }
  17704. }
  17705. <?php
  17706. namespace Composer\Package;
  17707. use Composer\Repository\RepositoryInterface;
  17708. use Composer\Repository\PlatformRepository;
  17709. abstract class BasePackage implements PackageInterface
  17710. {
  17711. public static $supportedLinkTypes = array(
  17712. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17713. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17714. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17715. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17716. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17717. );
  17718. const STABILITY_STABLE = 0;
  17719. const STABILITY_RC = 5;
  17720. const STABILITY_BETA = 10;
  17721. const STABILITY_ALPHA = 15;
  17722. const STABILITY_DEV = 20;
  17723. public static $stabilities = array(
  17724. 'stable' => self::STABILITY_STABLE,
  17725. 'RC' => self::STABILITY_RC,
  17726. 'beta' => self::STABILITY_BETA,
  17727. 'alpha' => self::STABILITY_ALPHA,
  17728. 'dev' => self::STABILITY_DEV,
  17729. );
  17730. public $id;
  17731. protected $name;
  17732. protected $prettyName;
  17733. protected $repository;
  17734. protected $transportOptions = array();
  17735. public function __construct($name)
  17736. {
  17737. $this->prettyName = $name;
  17738. $this->name = strtolower($name);
  17739. $this->id = -1;
  17740. }
  17741. public function getName()
  17742. {
  17743. return $this->name;
  17744. }
  17745. public function getPrettyName()
  17746. {
  17747. return $this->prettyName;
  17748. }
  17749. public function getNames()
  17750. {
  17751. $names = array(
  17752. $this->getName() => true,
  17753. );
  17754. foreach ($this->getProvides() as $link) {
  17755. $names[$link->getTarget()] = true;
  17756. }
  17757. foreach ($this->getReplaces() as $link) {
  17758. $names[$link->getTarget()] = true;
  17759. }
  17760. return array_keys($names);
  17761. }
  17762. public function setId($id)
  17763. {
  17764. $this->id = $id;
  17765. }
  17766. public function getId()
  17767. {
  17768. return $this->id;
  17769. }
  17770. public function setRepository(RepositoryInterface $repository)
  17771. {
  17772. if ($this->repository && $repository !== $this->repository) {
  17773. throw new \LogicException('A package can only be added to one repository');
  17774. }
  17775. $this->repository = $repository;
  17776. }
  17777. public function getRepository()
  17778. {
  17779. return $this->repository;
  17780. }
  17781. public function getTransportOptions()
  17782. {
  17783. return $this->transportOptions;
  17784. }
  17785. public function setTransportOptions(array $options)
  17786. {
  17787. $this->transportOptions = $options;
  17788. }
  17789. public function isPlatform()
  17790. {
  17791. return $this->getRepository() instanceof PlatformRepository;
  17792. }
  17793. public function getUniqueName()
  17794. {
  17795. return $this->getName().'-'.$this->getVersion();
  17796. }
  17797. public function equals(PackageInterface $package)
  17798. {
  17799. $self = $this;
  17800. if ($this instanceof AliasPackage) {
  17801. $self = $this->getAliasOf();
  17802. }
  17803. if ($package instanceof AliasPackage) {
  17804. $package = $package->getAliasOf();
  17805. }
  17806. return $package === $self;
  17807. }
  17808. public function __toString()
  17809. {
  17810. return $this->getUniqueName();
  17811. }
  17812. public function getPrettyString()
  17813. {
  17814. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17815. }
  17816. public function getFullPrettyVersion($truncate = true)
  17817. {
  17818. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17819. return $this->getPrettyVersion();
  17820. }
  17821. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17822. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17823. }
  17824. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17825. }
  17826. public function getStabilityPriority()
  17827. {
  17828. return self::$stabilities[$this->getStability()];
  17829. }
  17830. public function __clone()
  17831. {
  17832. $this->repository = null;
  17833. $this->id = -1;
  17834. }
  17835. public static function packageNameToRegexp($allowListPattern, $wrap = '{^%s$}i')
  17836. {
  17837. $cleanedAllowListPattern = str_replace('\\*', '.*', preg_quote($allowListPattern));
  17838. return sprintf($wrap, $cleanedAllowListPattern);
  17839. }
  17840. }
  17841. <?php
  17842. namespace Composer\Package\Comparer;
  17843. class Comparer
  17844. {
  17845. private $source;
  17846. private $update;
  17847. private $changed;
  17848. public function setSource($source)
  17849. {
  17850. $this->source = $source;
  17851. }
  17852. public function setUpdate($update)
  17853. {
  17854. $this->update = $update;
  17855. }
  17856. public function getChanged($toString = false, $explicated = false)
  17857. {
  17858. $changed = $this->changed;
  17859. if (!count($changed)) {
  17860. return false;
  17861. }
  17862. if ($explicated) {
  17863. foreach ($changed as $sectionKey => $itemSection) {
  17864. foreach ($itemSection as $itemKey => $item) {
  17865. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17866. }
  17867. }
  17868. }
  17869. if ($toString) {
  17870. foreach ($changed as $sectionKey => $itemSection) {
  17871. foreach ($itemSection as $itemKey => $item) {
  17872. $changed['string'][] = $item."\r\n";
  17873. }
  17874. }
  17875. $changed = implode("\r\n", $changed['string']);
  17876. }
  17877. return $changed;
  17878. }
  17879. public function doCompare()
  17880. {
  17881. $source = array();
  17882. $destination = array();
  17883. $this->changed = array();
  17884. $currentDirectory = getcwd();
  17885. chdir($this->source);
  17886. $source = $this->doTree('.', $source);
  17887. if (!is_array($source)) {
  17888. return;
  17889. }
  17890. chdir($currentDirectory);
  17891. chdir($this->update);
  17892. $destination = $this->doTree('.', $destination);
  17893. if (!is_array($destination)) {
  17894. exit;
  17895. }
  17896. chdir($currentDirectory);
  17897. foreach ($source as $dir => $value) {
  17898. foreach ($value as $file => $hash) {
  17899. if (isset($destination[$dir][$file])) {
  17900. if ($hash !== $destination[$dir][$file]) {
  17901. $this->changed['changed'][] = $dir.'/'.$file;
  17902. }
  17903. } else {
  17904. $this->changed['removed'][] = $dir.'/'.$file;
  17905. }
  17906. }
  17907. }
  17908. foreach ($destination as $dir => $value) {
  17909. foreach ($value as $file => $hash) {
  17910. if (!isset($source[$dir][$file])) {
  17911. $this->changed['added'][] = $dir.'/'.$file;
  17912. }
  17913. }
  17914. }
  17915. }
  17916. private function doTree($dir, &$array)
  17917. {
  17918. if ($dh = opendir($dir)) {
  17919. while ($file = readdir($dh)) {
  17920. if ($file !== '.' && $file !== '..') {
  17921. if (is_link($dir.'/'.$file)) {
  17922. $array[$dir][$file] = readlink($dir.'/'.$file);
  17923. } elseif (is_dir($dir.'/'.$file)) {
  17924. if (!count($array)) {
  17925. $array[0] = 'Temp';
  17926. }
  17927. if (!$this->doTree($dir.'/'.$file, $array)) {
  17928. return false;
  17929. }
  17930. } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
  17931. set_time_limit(30);
  17932. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17933. }
  17934. }
  17935. }
  17936. if (count($array) > 1 && isset($array['0'])) {
  17937. unset($array['0']);
  17938. }
  17939. return $array;
  17940. }
  17941. return false;
  17942. }
  17943. }
  17944. <?php
  17945. namespace Composer\Package;
  17946. class CompletePackage extends Package implements CompletePackageInterface
  17947. {
  17948. protected $repositories;
  17949. protected $license = array();
  17950. protected $keywords;
  17951. protected $authors;
  17952. protected $description;
  17953. protected $homepage;
  17954. protected $scripts = array();
  17955. protected $support = array();
  17956. protected $funding = array();
  17957. protected $abandoned = false;
  17958. public function setScripts(array $scripts)
  17959. {
  17960. $this->scripts = $scripts;
  17961. }
  17962. public function getScripts()
  17963. {
  17964. return $this->scripts;
  17965. }
  17966. public function setRepositories($repositories)
  17967. {
  17968. $this->repositories = $repositories;
  17969. }
  17970. public function getRepositories()
  17971. {
  17972. return $this->repositories;
  17973. }
  17974. public function setLicense(array $license)
  17975. {
  17976. $this->license = $license;
  17977. }
  17978. public function getLicense()
  17979. {
  17980. return $this->license;
  17981. }
  17982. public function setKeywords(array $keywords)
  17983. {
  17984. $this->keywords = $keywords;
  17985. }
  17986. public function getKeywords()
  17987. {
  17988. return $this->keywords;
  17989. }
  17990. public function setAuthors(array $authors)
  17991. {
  17992. $this->authors = $authors;
  17993. }
  17994. public function getAuthors()
  17995. {
  17996. return $this->authors;
  17997. }
  17998. public function setDescription($description)
  17999. {
  18000. $this->description = $description;
  18001. }
  18002. public function getDescription()
  18003. {
  18004. return $this->description;
  18005. }
  18006. public function setHomepage($homepage)
  18007. {
  18008. $this->homepage = $homepage;
  18009. }
  18010. public function getHomepage()
  18011. {
  18012. return $this->homepage;
  18013. }
  18014. public function setSupport(array $support)
  18015. {
  18016. $this->support = $support;
  18017. }
  18018. public function getSupport()
  18019. {
  18020. return $this->support;
  18021. }
  18022. public function setFunding(array $funding)
  18023. {
  18024. $this->funding = $funding;
  18025. }
  18026. public function getFunding()
  18027. {
  18028. return $this->funding;
  18029. }
  18030. public function isAbandoned()
  18031. {
  18032. return (bool) $this->abandoned;
  18033. }
  18034. public function setAbandoned($abandoned)
  18035. {
  18036. $this->abandoned = $abandoned;
  18037. }
  18038. public function getReplacementPackage()
  18039. {
  18040. return is_string($this->abandoned) ? $this->abandoned : null;
  18041. }
  18042. }
  18043. <?php
  18044. namespace Composer\Package;
  18045. interface CompletePackageInterface extends PackageInterface
  18046. {
  18047. public function getScripts();
  18048. public function getRepositories();
  18049. public function getLicense();
  18050. public function getKeywords();
  18051. public function getDescription();
  18052. public function getHomepage();
  18053. public function getAuthors();
  18054. public function getSupport();
  18055. public function getFunding();
  18056. public function isAbandoned();
  18057. public function getReplacementPackage();
  18058. }
  18059. <?php
  18060. namespace Composer\Package\Dumper;
  18061. use Composer\Package\BasePackage;
  18062. use Composer\Package\PackageInterface;
  18063. use Composer\Package\CompletePackageInterface;
  18064. use Composer\Package\RootPackageInterface;
  18065. class ArrayDumper
  18066. {
  18067. public function dump(PackageInterface $package)
  18068. {
  18069. $keys = array(
  18070. 'binaries' => 'bin',
  18071. 'type',
  18072. 'extra',
  18073. 'installationSource' => 'installation-source',
  18074. 'autoload',
  18075. 'devAutoload' => 'autoload-dev',
  18076. 'notificationUrl' => 'notification-url',
  18077. 'includePaths' => 'include-path',
  18078. );
  18079. $data = array();
  18080. $data['name'] = $package->getPrettyName();
  18081. $data['version'] = $package->getPrettyVersion();
  18082. $data['version_normalized'] = $package->getVersion();
  18083. if ($package->getTargetDir()) {
  18084. $data['target-dir'] = $package->getTargetDir();
  18085. }
  18086. if ($package->getSourceType()) {
  18087. $data['source']['type'] = $package->getSourceType();
  18088. $data['source']['url'] = $package->getSourceUrl();
  18089. if (null !== ($value = $package->getSourceReference())) {
  18090. $data['source']['reference'] = $value;
  18091. }
  18092. if ($mirrors = $package->getSourceMirrors()) {
  18093. $data['source']['mirrors'] = $mirrors;
  18094. }
  18095. }
  18096. if ($package->getDistType()) {
  18097. $data['dist']['type'] = $package->getDistType();
  18098. $data['dist']['url'] = $package->getDistUrl();
  18099. if (null !== ($value = $package->getDistReference())) {
  18100. $data['dist']['reference'] = $value;
  18101. }
  18102. if (null !== ($value = $package->getDistSha1Checksum())) {
  18103. $data['dist']['shasum'] = $value;
  18104. }
  18105. if ($mirrors = $package->getDistMirrors()) {
  18106. $data['dist']['mirrors'] = $mirrors;
  18107. }
  18108. }
  18109. if ($package->getArchiveExcludes()) {
  18110. $data['archive']['exclude'] = $package->getArchiveExcludes();
  18111. }
  18112. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  18113. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  18114. foreach ($links as $link) {
  18115. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  18116. }
  18117. ksort($data[$type]);
  18118. }
  18119. }
  18120. if ($packages = $package->getSuggests()) {
  18121. ksort($packages);
  18122. $data['suggest'] = $packages;
  18123. }
  18124. if ($package->getReleaseDate()) {
  18125. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  18126. }
  18127. $data = $this->dumpValues($package, $keys, $data);
  18128. if ($package instanceof CompletePackageInterface) {
  18129. $keys = array(
  18130. 'scripts',
  18131. 'license',
  18132. 'authors',
  18133. 'description',
  18134. 'homepage',
  18135. 'keywords',
  18136. 'repositories',
  18137. 'support',
  18138. 'funding',
  18139. );
  18140. $data = $this->dumpValues($package, $keys, $data);
  18141. if (isset($data['keywords']) && is_array($data['keywords'])) {
  18142. sort($data['keywords']);
  18143. }
  18144. if ($package->isAbandoned()) {
  18145. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  18146. }
  18147. }
  18148. if ($package instanceof RootPackageInterface) {
  18149. $minimumStability = $package->getMinimumStability();
  18150. if ($minimumStability) {
  18151. $data['minimum-stability'] = $minimumStability;
  18152. }
  18153. }
  18154. if (count($package->getTransportOptions()) > 0) {
  18155. $data['transport-options'] = $package->getTransportOptions();
  18156. }
  18157. return $data;
  18158. }
  18159. private function dumpValues(PackageInterface $package, array $keys, array $data)
  18160. {
  18161. foreach ($keys as $method => $key) {
  18162. if (is_numeric($method)) {
  18163. $method = $key;
  18164. }
  18165. $getter = 'get'.ucfirst($method);
  18166. $value = $package->$getter();
  18167. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  18168. $data[$key] = $value;
  18169. }
  18170. }
  18171. return $data;
  18172. }
  18173. }
  18174. <?php
  18175. namespace Composer\Package;
  18176. use Composer\Semver\Constraint\ConstraintInterface;
  18177. class Link
  18178. {
  18179. protected $source;
  18180. protected $target;
  18181. protected $constraint;
  18182. protected $description;
  18183. protected $prettyConstraint;
  18184. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  18185. {
  18186. $this->source = strtolower($source);
  18187. $this->target = strtolower($target);
  18188. $this->constraint = $constraint;
  18189. $this->description = $description;
  18190. $this->prettyConstraint = $prettyConstraint;
  18191. }
  18192. public function getDescription()
  18193. {
  18194. return $this->description;
  18195. }
  18196. public function getSource()
  18197. {
  18198. return $this->source;
  18199. }
  18200. public function getTarget()
  18201. {
  18202. return $this->target;
  18203. }
  18204. public function getConstraint()
  18205. {
  18206. return $this->constraint;
  18207. }
  18208. public function getPrettyConstraint()
  18209. {
  18210. if (null === $this->prettyConstraint) {
  18211. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  18212. }
  18213. return $this->prettyConstraint;
  18214. }
  18215. public function __toString()
  18216. {
  18217. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  18218. }
  18219. public function getPrettyString(PackageInterface $sourcePackage)
  18220. {
  18221. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  18222. }
  18223. }
  18224. <?php
  18225. namespace Composer\Package\LinkConstraint;
  18226. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  18227. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  18228. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  18229. {
  18230. }
  18231. <?php
  18232. namespace Composer\Package\LinkConstraint;
  18233. use Composer\Semver\Constraint\ConstraintInterface;
  18234. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  18235. interface LinkConstraintInterface extends ConstraintInterface
  18236. {
  18237. }
  18238. <?php
  18239. namespace Composer\Package\LinkConstraint;
  18240. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  18241. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  18242. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  18243. {
  18244. }
  18245. <?php
  18246. namespace Composer\Package\LinkConstraint;
  18247. use Composer\Semver\Constraint\AbstractConstraint;
  18248. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  18249. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  18250. {
  18251. }
  18252. <?php
  18253. namespace Composer\Package\LinkConstraint;
  18254. use Composer\Semver\Constraint\Constraint;
  18255. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  18256. class VersionConstraint extends Constraint implements LinkConstraintInterface
  18257. {
  18258. }
  18259. <?php
  18260. namespace Composer\Package\Loader;
  18261. use Composer\Package;
  18262. use Composer\Package\AliasPackage;
  18263. use Composer\Package\Link;
  18264. use Composer\Package\RootAliasPackage;
  18265. use Composer\Package\RootPackageInterface;
  18266. use Composer\Package\Version\VersionParser;
  18267. use Composer\Semver\VersionParser as SemverVersionParser;
  18268. class ArrayLoader implements LoaderInterface
  18269. {
  18270. protected $versionParser;
  18271. protected $loadOptions;
  18272. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  18273. {
  18274. if (!$parser) {
  18275. $parser = new VersionParser;
  18276. }
  18277. $this->versionParser = $parser;
  18278. $this->loadOptions = $loadOptions;
  18279. }
  18280. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18281. {
  18282. if (!isset($config['name'])) {
  18283. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  18284. }
  18285. if (!isset($config['version'])) {
  18286. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  18287. }
  18288. if (isset($config['version_normalized'])) {
  18289. $version = $config['version_normalized'];
  18290. } else {
  18291. $version = $this->versionParser->normalize($config['version']);
  18292. }
  18293. $package = new $class($config['name'], $version, $config['version']);
  18294. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  18295. if (isset($config['target-dir'])) {
  18296. $package->setTargetDir($config['target-dir']);
  18297. }
  18298. if (isset($config['extra']) && is_array($config['extra'])) {
  18299. $package->setExtra($config['extra']);
  18300. }
  18301. if (isset($config['bin'])) {
  18302. foreach ((array) $config['bin'] as $key => $bin) {
  18303. $config['bin'][$key] = ltrim($bin, '/');
  18304. }
  18305. $package->setBinaries((array) $config['bin']);
  18306. }
  18307. if (isset($config['installation-source'])) {
  18308. $package->setInstallationSource($config['installation-source']);
  18309. }
  18310. if (isset($config['source'])) {
  18311. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  18312. throw new \UnexpectedValueException(sprintf(
  18313. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  18314. $config['name'],
  18315. json_encode($config['source'])
  18316. ));
  18317. }
  18318. $package->setSourceType($config['source']['type']);
  18319. $package->setSourceUrl($config['source']['url']);
  18320. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  18321. if (isset($config['source']['mirrors'])) {
  18322. $package->setSourceMirrors($config['source']['mirrors']);
  18323. }
  18324. }
  18325. if (isset($config['dist'])) {
  18326. if (!isset($config['dist']['type'])
  18327. || !isset($config['dist']['url'])) {
  18328. throw new \UnexpectedValueException(sprintf(
  18329. "Package %s's dist key should be specified as ".
  18330. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  18331. $config['name'],
  18332. json_encode($config['dist'])
  18333. ));
  18334. }
  18335. $package->setDistType($config['dist']['type']);
  18336. $package->setDistUrl($config['dist']['url']);
  18337. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  18338. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  18339. if (isset($config['dist']['mirrors'])) {
  18340. $package->setDistMirrors($config['dist']['mirrors']);
  18341. }
  18342. }
  18343. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  18344. if (isset($config[$type])) {
  18345. $method = 'set'.ucfirst($opts['method']);
  18346. $package->{$method}(
  18347. $this->parseLinks(
  18348. $package->getName(),
  18349. $package->getPrettyVersion(),
  18350. $opts['description'],
  18351. $config[$type]
  18352. )
  18353. );
  18354. }
  18355. }
  18356. if (isset($config['suggest']) && is_array($config['suggest'])) {
  18357. foreach ($config['suggest'] as $target => $reason) {
  18358. if ('self.version' === trim($reason)) {
  18359. $config['suggest'][$target] = $package->getPrettyVersion();
  18360. }
  18361. }
  18362. $package->setSuggests($config['suggest']);
  18363. }
  18364. if (isset($config['autoload'])) {
  18365. $package->setAutoload($config['autoload']);
  18366. }
  18367. if (isset($config['autoload-dev'])) {
  18368. $package->setDevAutoload($config['autoload-dev']);
  18369. }
  18370. if (isset($config['include-path'])) {
  18371. $package->setIncludePaths($config['include-path']);
  18372. }
  18373. if (!empty($config['time'])) {
  18374. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  18375. try {
  18376. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  18377. $package->setReleaseDate($date);
  18378. } catch (\Exception $e) {
  18379. }
  18380. }
  18381. if (!empty($config['notification-url'])) {
  18382. $package->setNotificationUrl($config['notification-url']);
  18383. }
  18384. if (!empty($config['archive']['exclude'])) {
  18385. $package->setArchiveExcludes($config['archive']['exclude']);
  18386. }
  18387. if ($package instanceof Package\CompletePackageInterface) {
  18388. if (isset($config['scripts']) && is_array($config['scripts'])) {
  18389. foreach ($config['scripts'] as $event => $listeners) {
  18390. $config['scripts'][$event] = (array) $listeners;
  18391. }
  18392. if (isset($config['scripts']['composer'])) {
  18393. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  18394. }
  18395. $package->setScripts($config['scripts']);
  18396. }
  18397. if (!empty($config['description']) && is_string($config['description'])) {
  18398. $package->setDescription($config['description']);
  18399. }
  18400. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  18401. $package->setHomepage($config['homepage']);
  18402. }
  18403. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  18404. $package->setKeywords($config['keywords']);
  18405. }
  18406. if (!empty($config['license'])) {
  18407. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  18408. }
  18409. if (!empty($config['authors']) && is_array($config['authors'])) {
  18410. $package->setAuthors($config['authors']);
  18411. }
  18412. if (isset($config['support'])) {
  18413. $package->setSupport($config['support']);
  18414. }
  18415. if (!empty($config['funding']) && is_array($config['funding'])) {
  18416. $package->setFunding($config['funding']);
  18417. }
  18418. if (isset($config['abandoned'])) {
  18419. $package->setAbandoned($config['abandoned']);
  18420. }
  18421. }
  18422. if ($aliasNormalized = $this->getBranchAlias($config)) {
  18423. if ($package instanceof RootPackageInterface) {
  18424. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18425. } else {
  18426. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18427. }
  18428. }
  18429. if ($this->loadOptions && isset($config['transport-options'])) {
  18430. $package->setTransportOptions($config['transport-options']);
  18431. }
  18432. return $package;
  18433. }
  18434. public function parseLinks($source, $sourceVersion, $description, $links)
  18435. {
  18436. $res = array();
  18437. foreach ($links as $target => $constraint) {
  18438. if (!is_string($constraint)) {
  18439. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  18440. }
  18441. if ('self.version' === $constraint) {
  18442. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  18443. } else {
  18444. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  18445. }
  18446. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  18447. }
  18448. return $res;
  18449. }
  18450. public function getBranchAlias(array $config)
  18451. {
  18452. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  18453. || !isset($config['extra']['branch-alias'])
  18454. || !is_array($config['extra']['branch-alias'])
  18455. ) {
  18456. return;
  18457. }
  18458. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18459. if ('-dev' !== substr($targetBranch, -4)) {
  18460. continue;
  18461. }
  18462. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18463. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18464. continue;
  18465. }
  18466. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  18467. continue;
  18468. }
  18469. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18470. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18471. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18472. ) {
  18473. continue;
  18474. }
  18475. return $validatedTargetBranch;
  18476. }
  18477. }
  18478. }
  18479. <?php
  18480. namespace Composer\Package\Loader;
  18481. class InvalidPackageException extends \Exception
  18482. {
  18483. private $errors;
  18484. private $warnings;
  18485. private $data;
  18486. public function __construct(array $errors, array $warnings, array $data)
  18487. {
  18488. $this->errors = $errors;
  18489. $this->warnings = $warnings;
  18490. $this->data = $data;
  18491. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  18492. }
  18493. public function getData()
  18494. {
  18495. return $this->data;
  18496. }
  18497. public function getErrors()
  18498. {
  18499. return $this->errors;
  18500. }
  18501. public function getWarnings()
  18502. {
  18503. return $this->warnings;
  18504. }
  18505. }
  18506. <?php
  18507. namespace Composer\Package\Loader;
  18508. use Composer\Json\JsonFile;
  18509. class JsonLoader
  18510. {
  18511. private $loader;
  18512. public function __construct(LoaderInterface $loader)
  18513. {
  18514. $this->loader = $loader;
  18515. }
  18516. public function load($json)
  18517. {
  18518. if ($json instanceof JsonFile) {
  18519. $config = $json->read();
  18520. } elseif (file_exists($json)) {
  18521. $config = JsonFile::parseJson(file_get_contents($json), $json);
  18522. } elseif (is_string($json)) {
  18523. $config = JsonFile::parseJson($json);
  18524. }
  18525. return $this->loader->load($config);
  18526. }
  18527. }
  18528. <?php
  18529. namespace Composer\Package\Loader;
  18530. interface LoaderInterface
  18531. {
  18532. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  18533. }
  18534. <?php
  18535. namespace Composer\Package\Loader;
  18536. use Composer\Package\BasePackage;
  18537. use Composer\Package\AliasPackage;
  18538. use Composer\Config;
  18539. use Composer\IO\IOInterface;
  18540. use Composer\Package\RootPackageInterface;
  18541. use Composer\Repository\RepositoryFactory;
  18542. use Composer\Package\Version\VersionGuesser;
  18543. use Composer\Package\Version\VersionParser;
  18544. use Composer\Repository\RepositoryManager;
  18545. use Composer\Util\ProcessExecutor;
  18546. class RootPackageLoader extends ArrayLoader
  18547. {
  18548. private $manager;
  18549. private $config;
  18550. private $versionGuesser;
  18551. private $io;
  18552. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  18553. {
  18554. parent::__construct($parser);
  18555. $this->manager = $manager;
  18556. $this->config = $config;
  18557. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  18558. $this->io = $io;
  18559. }
  18560. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  18561. {
  18562. if (!isset($config['name'])) {
  18563. $config['name'] = '__root__';
  18564. } elseif ($this->io) {
  18565. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  18566. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18567. }
  18568. }
  18569. $autoVersioned = false;
  18570. if (!isset($config['version'])) {
  18571. $commit = null;
  18572. if (getenv('COMPOSER_ROOT_VERSION')) {
  18573. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  18574. } else {
  18575. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  18576. if ($versionData) {
  18577. $config['version'] = $versionData['pretty_version'];
  18578. $config['version_normalized'] = $versionData['version'];
  18579. $commit = $versionData['commit'];
  18580. }
  18581. }
  18582. if (!isset($config['version'])) {
  18583. $config['version'] = '1.0.0';
  18584. $autoVersioned = true;
  18585. }
  18586. if ($commit) {
  18587. $config['source'] = array(
  18588. 'type' => '',
  18589. 'url' => '',
  18590. 'reference' => $commit,
  18591. );
  18592. $config['dist'] = array(
  18593. 'type' => '',
  18594. 'url' => '',
  18595. 'reference' => $commit,
  18596. );
  18597. }
  18598. }
  18599. $realPackage = $package = parent::load($config, $class);
  18600. if ($realPackage instanceof AliasPackage) {
  18601. $realPackage = $package->getAliasOf();
  18602. }
  18603. if ($autoVersioned) {
  18604. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  18605. }
  18606. if (isset($config['minimum-stability'])) {
  18607. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  18608. }
  18609. $aliases = array();
  18610. $stabilityFlags = array();
  18611. $references = array();
  18612. foreach (array('require', 'require-dev') as $linkType) {
  18613. if (isset($config[$linkType])) {
  18614. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  18615. $method = 'get'.ucfirst($linkInfo['method']);
  18616. $links = array();
  18617. foreach ($realPackage->$method() as $link) {
  18618. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  18619. }
  18620. $aliases = $this->extractAliases($links, $aliases);
  18621. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  18622. $references = $this->extractReferences($links, $references);
  18623. if (isset($links[$config['name']])) {
  18624. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  18625. 'Did you accidentally name your root package after an external package?', $config['name']));
  18626. }
  18627. }
  18628. }
  18629. if ($this->io) {
  18630. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18631. if (isset($config[$linkType])) {
  18632. foreach ($config[$linkType] as $linkName => $constraint) {
  18633. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  18634. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18635. }
  18636. }
  18637. }
  18638. }
  18639. }
  18640. $realPackage->setAliases($aliases);
  18641. $realPackage->setStabilityFlags($stabilityFlags);
  18642. $realPackage->setReferences($references);
  18643. if (isset($config['prefer-stable'])) {
  18644. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  18645. }
  18646. if (isset($config['config'])) {
  18647. $realPackage->setConfig($config['config']);
  18648. }
  18649. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  18650. foreach ($repos as $repo) {
  18651. $this->manager->addRepository($repo);
  18652. }
  18653. $realPackage->setRepositories($this->config->getRepositories());
  18654. return $package;
  18655. }
  18656. private function extractAliases(array $requires, array $aliases)
  18657. {
  18658. foreach ($requires as $reqName => $reqVersion) {
  18659. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  18660. $aliases[] = array(
  18661. 'package' => strtolower($reqName),
  18662. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  18663. 'alias' => $match[2],
  18664. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  18665. );
  18666. } elseif (strpos($reqVersion, ' as ') !== false) {
  18667. throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
  18668. }
  18669. }
  18670. return $aliases;
  18671. }
  18672. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  18673. {
  18674. $stabilities = BasePackage::$stabilities;
  18675. $minimumStability = $stabilities[$minimumStability];
  18676. foreach ($requires as $reqName => $reqVersion) {
  18677. $constraints = array();
  18678. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  18679. foreach ($orSplit as $orConstraint) {
  18680. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  18681. foreach ($andSplit as $andConstraint) {
  18682. $constraints[] = $andConstraint;
  18683. }
  18684. }
  18685. $match = false;
  18686. foreach ($constraints as $constraint) {
  18687. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  18688. $name = strtolower($reqName);
  18689. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  18690. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  18691. continue;
  18692. }
  18693. $stabilityFlags[$name] = $stability;
  18694. $match = true;
  18695. }
  18696. }
  18697. if ($match) {
  18698. continue;
  18699. }
  18700. foreach ($constraints as $constraint) {
  18701. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  18702. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  18703. $name = strtolower($reqName);
  18704. $stability = $stabilities[$stabilityName];
  18705. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18706. continue;
  18707. }
  18708. $stabilityFlags[$name] = $stability;
  18709. }
  18710. }
  18711. }
  18712. return $stabilityFlags;
  18713. }
  18714. private function extractReferences(array $requires, array $references)
  18715. {
  18716. foreach ($requires as $reqName => $reqVersion) {
  18717. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18718. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18719. $name = strtolower($reqName);
  18720. $references[$name] = $match[1];
  18721. }
  18722. }
  18723. return $references;
  18724. }
  18725. }
  18726. <?php
  18727. namespace Composer\Package\Loader;
  18728. use Composer\Package\BasePackage;
  18729. use Composer\Semver\Constraint\Constraint;
  18730. use Composer\Package\Version\VersionParser;
  18731. use Composer\Repository\PlatformRepository;
  18732. use Composer\Spdx\SpdxLicenses;
  18733. class ValidatingArrayLoader implements LoaderInterface
  18734. {
  18735. const CHECK_ALL = 3;
  18736. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18737. const CHECK_STRICT_CONSTRAINTS = 2;
  18738. private $loader;
  18739. private $versionParser;
  18740. private $errors;
  18741. private $warnings;
  18742. private $config;
  18743. private $strictName;
  18744. private $flags;
  18745. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18746. {
  18747. $this->loader = $loader;
  18748. $this->versionParser = $parser ?: new VersionParser();
  18749. $this->strictName = $strictName;
  18750. $this->flags = $flags;
  18751. }
  18752. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18753. {
  18754. $this->errors = array();
  18755. $this->warnings = array();
  18756. $this->config = $config;
  18757. if ($err = self::hasPackageNamingError($config['name'])) {
  18758. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18759. }
  18760. if ($this->strictName) {
  18761. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18762. } else {
  18763. $this->validateString('name', true);
  18764. }
  18765. if (!empty($this->config['version'])) {
  18766. try {
  18767. $this->versionParser->normalize($this->config['version']);
  18768. } catch (\Exception $e) {
  18769. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18770. unset($this->config['version']);
  18771. }
  18772. }
  18773. if (!empty($this->config['config']['platform'])) {
  18774. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18775. try {
  18776. $this->versionParser->normalize($platform);
  18777. } catch (\Exception $e) {
  18778. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18779. }
  18780. }
  18781. }
  18782. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18783. $this->validateString('target-dir');
  18784. $this->validateArray('extra');
  18785. if (isset($this->config['bin'])) {
  18786. if (is_string($this->config['bin'])) {
  18787. $this->validateString('bin');
  18788. } else {
  18789. $this->validateFlatArray('bin');
  18790. }
  18791. }
  18792. $this->validateArray('scripts');
  18793. $this->validateString('description');
  18794. $this->validateUrl('homepage');
  18795. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18796. $releaseDate = null;
  18797. $this->validateString('time');
  18798. if (!empty($this->config['time'])) {
  18799. try {
  18800. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18801. } catch (\Exception $e) {
  18802. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18803. unset($this->config['time']);
  18804. }
  18805. }
  18806. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18807. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18808. $licenses = (array) $this->config['license'];
  18809. $licenseValidator = new SpdxLicenses();
  18810. foreach ($licenses as $license) {
  18811. if ('proprietary' === $license) {
  18812. continue;
  18813. }
  18814. $licenseToValidate = str_replace('proprietary', 'MIT', $license);
  18815. if (!$licenseValidator->validate($licenseToValidate)) {
  18816. if ($licenseValidator->validate(trim($licenseToValidate))) {
  18817. $this->warnings[] = sprintf(
  18818. 'License %s must not contain extra spaces, make sure to trim it.',
  18819. json_encode($license)
  18820. );
  18821. } else {
  18822. $this->warnings[] = sprintf(
  18823. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18824. 'If the software is closed-source, you may use "proprietary" as license.',
  18825. json_encode($license)
  18826. );
  18827. }
  18828. }
  18829. }
  18830. }
  18831. }
  18832. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18833. foreach ($this->config['authors'] as $key => $author) {
  18834. if (!is_array($author)) {
  18835. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18836. unset($this->config['authors'][$key]);
  18837. continue;
  18838. }
  18839. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18840. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18841. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18842. unset($this->config['authors'][$key][$authorData]);
  18843. }
  18844. }
  18845. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18846. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18847. unset($this->config['authors'][$key]['homepage']);
  18848. }
  18849. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18850. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18851. unset($this->config['authors'][$key]['email']);
  18852. }
  18853. if (empty($this->config['authors'][$key])) {
  18854. unset($this->config['authors'][$key]);
  18855. }
  18856. }
  18857. if (empty($this->config['authors'])) {
  18858. unset($this->config['authors']);
  18859. }
  18860. }
  18861. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18862. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18863. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18864. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18865. unset($this->config['support'][$key]);
  18866. }
  18867. }
  18868. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18869. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18870. unset($this->config['support']['email']);
  18871. }
  18872. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18873. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18874. unset($this->config['support']['irc']);
  18875. }
  18876. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18877. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18878. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18879. unset($this->config['support'][$key]);
  18880. }
  18881. }
  18882. if (empty($this->config['support'])) {
  18883. unset($this->config['support']);
  18884. }
  18885. }
  18886. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  18887. foreach ($this->config['funding'] as $key => $fundingOption) {
  18888. if (!is_array($fundingOption)) {
  18889. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  18890. unset($this->config['funding'][$key]);
  18891. continue;
  18892. }
  18893. foreach (array('type', 'url') as $fundingData) {
  18894. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  18895. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  18896. unset($this->config['funding'][$key][$fundingData]);
  18897. }
  18898. }
  18899. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  18900. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  18901. unset($this->config['funding'][$key]['url']);
  18902. }
  18903. if (empty($this->config['funding'][$key])) {
  18904. unset($this->config['funding'][$key]);
  18905. }
  18906. }
  18907. if (empty($this->config['funding'])) {
  18908. unset($this->config['funding']);
  18909. }
  18910. }
  18911. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18912. $stableConstraint = new Constraint('=', '1.0.0');
  18913. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18914. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18915. foreach ($this->config[$linkType] as $package => $constraint) {
  18916. if ($err = self::hasPackageNamingError($package, true)) {
  18917. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18918. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18919. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18920. }
  18921. if (!is_string($constraint)) {
  18922. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18923. unset($this->config[$linkType][$package]);
  18924. } elseif ('self.version' !== $constraint) {
  18925. try {
  18926. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18927. } catch (\Exception $e) {
  18928. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18929. unset($this->config[$linkType][$package]);
  18930. continue;
  18931. }
  18932. if (
  18933. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18934. && 'require' === $linkType
  18935. && $linkConstraint->matches($unboundConstraint)
  18936. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18937. ) {
  18938. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18939. } elseif (
  18940. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18941. && 'require' === $linkType
  18942. && substr($linkConstraint, 0, 1) === '='
  18943. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18944. ) {
  18945. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18946. }
  18947. }
  18948. }
  18949. }
  18950. }
  18951. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18952. foreach ($this->config['suggest'] as $package => $description) {
  18953. if (!is_string($description)) {
  18954. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18955. unset($this->config['suggest'][$package]);
  18956. }
  18957. }
  18958. }
  18959. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18960. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18961. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18962. unset($this->config['minimum-stability']);
  18963. }
  18964. }
  18965. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18966. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18967. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18968. if (!in_array($type, $types)) {
  18969. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18970. unset($this->config['autoload'][$type]);
  18971. }
  18972. if ($type === 'psr-4') {
  18973. foreach ($typeConfig as $namespace => $dirs) {
  18974. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18975. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18976. }
  18977. }
  18978. }
  18979. }
  18980. }
  18981. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18982. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18983. unset($this->config['autoload']['psr-4']);
  18984. }
  18985. $this->validateFlatArray('include-path');
  18986. $this->validateArray('transport-options');
  18987. if (isset($this->config['extra']['branch-alias'])) {
  18988. if (!is_array($this->config['extra']['branch-alias'])) {
  18989. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18990. } else {
  18991. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18992. if ('-dev' !== substr($targetBranch, -4)) {
  18993. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18994. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18995. continue;
  18996. }
  18997. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18998. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18999. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  19000. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19001. continue;
  19002. }
  19003. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  19004. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  19005. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  19006. ) {
  19007. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  19008. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19009. }
  19010. }
  19011. }
  19012. }
  19013. if ($this->errors) {
  19014. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  19015. }
  19016. $package = $this->loader->load($this->config, $class);
  19017. $this->config = null;
  19018. return $package;
  19019. }
  19020. public function getWarnings()
  19021. {
  19022. return $this->warnings;
  19023. }
  19024. public function getErrors()
  19025. {
  19026. return $this->errors;
  19027. }
  19028. public static function hasPackageNamingError($name, $isLink = false)
  19029. {
  19030. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  19031. return;
  19032. }
  19033. if (!preg_match('{^[a-z0-9](?:[_.-]?[a-z0-9]+)*/[a-z0-9](?:(?:[_.]?|-{0,2})[a-z0-9]+)*$}iD', $name)) {
  19034. 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]+)*$".';
  19035. }
  19036. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  19037. $bits = explode('/', strtolower($name));
  19038. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  19039. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  19040. }
  19041. if (preg_match('{\.json$}', $name)) {
  19042. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  19043. }
  19044. if (preg_match('{[A-Z]}', $name)) {
  19045. if ($isLink) {
  19046. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  19047. }
  19048. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  19049. $suggestName = strtolower($suggestName);
  19050. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  19051. }
  19052. }
  19053. private function validateRegex($property, $regex, $mandatory = false)
  19054. {
  19055. if (!$this->validateString($property, $mandatory)) {
  19056. return false;
  19057. }
  19058. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  19059. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  19060. if ($mandatory) {
  19061. $this->errors[] = $message;
  19062. } else {
  19063. $this->warnings[] = $message;
  19064. }
  19065. unset($this->config[$property]);
  19066. return false;
  19067. }
  19068. return true;
  19069. }
  19070. private function validateString($property, $mandatory = false)
  19071. {
  19072. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  19073. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  19074. unset($this->config[$property]);
  19075. return false;
  19076. }
  19077. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  19078. if ($mandatory) {
  19079. $this->errors[] = $property.' : must be present';
  19080. }
  19081. unset($this->config[$property]);
  19082. return false;
  19083. }
  19084. return true;
  19085. }
  19086. private function validateArray($property, $mandatory = false)
  19087. {
  19088. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  19089. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  19090. unset($this->config[$property]);
  19091. return false;
  19092. }
  19093. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  19094. if ($mandatory) {
  19095. $this->errors[] = $property.' : must be present and contain at least one element';
  19096. }
  19097. unset($this->config[$property]);
  19098. return false;
  19099. }
  19100. return true;
  19101. }
  19102. private function validateFlatArray($property, $regex = null, $mandatory = false)
  19103. {
  19104. if (!$this->validateArray($property, $mandatory)) {
  19105. return false;
  19106. }
  19107. $pass = true;
  19108. foreach ($this->config[$property] as $key => $value) {
  19109. if (!is_string($value) && !is_numeric($value)) {
  19110. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  19111. unset($this->config[$property][$key]);
  19112. $pass = false;
  19113. continue;
  19114. }
  19115. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  19116. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  19117. unset($this->config[$property][$key]);
  19118. $pass = false;
  19119. }
  19120. }
  19121. return $pass;
  19122. }
  19123. private function validateUrl($property, $mandatory = false)
  19124. {
  19125. if (!$this->validateString($property, $mandatory)) {
  19126. return false;
  19127. }
  19128. if (!$this->filterUrl($this->config[$property])) {
  19129. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  19130. unset($this->config[$property]);
  19131. return false;
  19132. }
  19133. return true;
  19134. }
  19135. private function filterUrl($value, array $schemes = array('http', 'https'))
  19136. {
  19137. if ($value === '') {
  19138. return true;
  19139. }
  19140. $bits = parse_url($value);
  19141. if (empty($bits['scheme']) || empty($bits['host'])) {
  19142. return false;
  19143. }
  19144. if (!in_array($bits['scheme'], $schemes, true)) {
  19145. return false;
  19146. }
  19147. return true;
  19148. }
  19149. }
  19150. <?php
  19151. namespace Composer\Package;
  19152. use Composer\Json\JsonFile;
  19153. use Composer\Installer\InstallationManager;
  19154. use Composer\Repository\RepositoryManager;
  19155. use Composer\Util\ProcessExecutor;
  19156. use Composer\Repository\ArrayRepository;
  19157. use Composer\Package\Dumper\ArrayDumper;
  19158. use Composer\Package\Loader\ArrayLoader;
  19159. use Composer\Plugin\PluginInterface;
  19160. use Composer\Util\Git as GitUtil;
  19161. use Composer\IO\IOInterface;
  19162. use Seld\JsonLint\ParsingException;
  19163. class Locker
  19164. {
  19165. private $lockFile;
  19166. private $repositoryManager;
  19167. private $installationManager;
  19168. private $hash;
  19169. private $contentHash;
  19170. private $loader;
  19171. private $dumper;
  19172. private $process;
  19173. private $lockDataCache;
  19174. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  19175. {
  19176. $this->lockFile = $lockFile;
  19177. $this->repositoryManager = $repositoryManager;
  19178. $this->installationManager = $installationManager;
  19179. $this->hash = md5($composerFileContents);
  19180. $this->contentHash = self::getContentHash($composerFileContents);
  19181. $this->loader = new ArrayLoader(null, true);
  19182. $this->dumper = new ArrayDumper();
  19183. $this->process = new ProcessExecutor($io);
  19184. }
  19185. public static function getContentHash($composerFileContents)
  19186. {
  19187. $content = json_decode($composerFileContents, true);
  19188. $relevantKeys = array(
  19189. 'name',
  19190. 'version',
  19191. 'require',
  19192. 'require-dev',
  19193. 'conflict',
  19194. 'replace',
  19195. 'provide',
  19196. 'minimum-stability',
  19197. 'prefer-stable',
  19198. 'repositories',
  19199. 'extra',
  19200. );
  19201. $relevantContent = array();
  19202. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  19203. $relevantContent[$key] = $content[$key];
  19204. }
  19205. if (isset($content['config']['platform'])) {
  19206. $relevantContent['config']['platform'] = $content['config']['platform'];
  19207. }
  19208. ksort($relevantContent);
  19209. return md5(json_encode($relevantContent));
  19210. }
  19211. public function isLocked()
  19212. {
  19213. if (!$this->lockFile->exists()) {
  19214. return false;
  19215. }
  19216. $data = $this->getLockData();
  19217. return isset($data['packages']);
  19218. }
  19219. public function isFresh()
  19220. {
  19221. $lock = $this->lockFile->read();
  19222. if (!empty($lock['content-hash'])) {
  19223. return $this->contentHash === $lock['content-hash'];
  19224. }
  19225. if (!empty($lock['hash'])) {
  19226. return $this->hash === $lock['hash'];
  19227. }
  19228. return false;
  19229. }
  19230. public function getLockedRepository($withDevReqs = false)
  19231. {
  19232. $lockData = $this->getLockData();
  19233. $packages = new ArrayRepository();
  19234. $lockedPackages = $lockData['packages'];
  19235. if ($withDevReqs) {
  19236. if (isset($lockData['packages-dev'])) {
  19237. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  19238. } else {
  19239. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  19240. }
  19241. }
  19242. if (empty($lockedPackages)) {
  19243. return $packages;
  19244. }
  19245. if (isset($lockedPackages[0]['name'])) {
  19246. foreach ($lockedPackages as $info) {
  19247. $packages->addPackage($this->loader->load($info));
  19248. }
  19249. return $packages;
  19250. }
  19251. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  19252. }
  19253. public function getPlatformRequirements($withDevReqs = false)
  19254. {
  19255. $lockData = $this->getLockData();
  19256. $requirements = array();
  19257. if (!empty($lockData['platform'])) {
  19258. $requirements = $this->loader->parseLinks(
  19259. '__ROOT__',
  19260. '1.0.0',
  19261. 'requires',
  19262. isset($lockData['platform']) ? $lockData['platform'] : array()
  19263. );
  19264. }
  19265. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  19266. $devRequirements = $this->loader->parseLinks(
  19267. '__ROOT__',
  19268. '1.0.0',
  19269. 'requires',
  19270. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  19271. );
  19272. $requirements = array_merge($requirements, $devRequirements);
  19273. }
  19274. return $requirements;
  19275. }
  19276. public function getMinimumStability()
  19277. {
  19278. $lockData = $this->getLockData();
  19279. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  19280. }
  19281. public function getStabilityFlags()
  19282. {
  19283. $lockData = $this->getLockData();
  19284. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  19285. }
  19286. public function getPreferStable()
  19287. {
  19288. $lockData = $this->getLockData();
  19289. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  19290. }
  19291. public function getPreferLowest()
  19292. {
  19293. $lockData = $this->getLockData();
  19294. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  19295. }
  19296. public function getPlatformOverrides()
  19297. {
  19298. $lockData = $this->getLockData();
  19299. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  19300. }
  19301. public function getAliases()
  19302. {
  19303. $lockData = $this->getLockData();
  19304. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  19305. }
  19306. public function getLockData()
  19307. {
  19308. if (null !== $this->lockDataCache) {
  19309. return $this->lockDataCache;
  19310. }
  19311. if (!$this->lockFile->exists()) {
  19312. throw new \LogicException('No lockfile found. Unable to read locked packages');
  19313. }
  19314. return $this->lockDataCache = $this->lockFile->read();
  19315. }
  19316. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  19317. {
  19318. $lock = array(
  19319. '_readme' => array('This file locks the dependencies of your project to a known state',
  19320. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  19321. 'This file is @gener'.'ated automatically', ),
  19322. 'content-hash' => $this->contentHash,
  19323. 'packages' => null,
  19324. 'packages-dev' => null,
  19325. 'aliases' => array(),
  19326. 'minimum-stability' => $minimumStability,
  19327. 'stability-flags' => $stabilityFlags,
  19328. 'prefer-stable' => $preferStable,
  19329. 'prefer-lowest' => $preferLowest,
  19330. );
  19331. foreach ($aliases as $package => $versions) {
  19332. foreach ($versions as $version => $alias) {
  19333. $lock['aliases'][] = array(
  19334. 'alias' => $alias['alias'],
  19335. 'alias_normalized' => $alias['alias_normalized'],
  19336. 'version' => $version,
  19337. 'package' => $package,
  19338. );
  19339. }
  19340. }
  19341. $lock['packages'] = $this->lockPackages($packages);
  19342. if (null !== $devPackages) {
  19343. $lock['packages-dev'] = $this->lockPackages($devPackages);
  19344. }
  19345. $lock['platform'] = $platformReqs;
  19346. $lock['platform-dev'] = $platformDevReqs;
  19347. if ($platformOverrides) {
  19348. $lock['platform-overrides'] = $platformOverrides;
  19349. }
  19350. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  19351. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  19352. if ($this->lockFile->exists()) {
  19353. unlink($this->lockFile->getPath());
  19354. }
  19355. return false;
  19356. }
  19357. try {
  19358. $isLocked = $this->isLocked();
  19359. } catch (ParsingException $e) {
  19360. $isLocked = false;
  19361. }
  19362. if (!$isLocked || $lock !== $this->getLockData()) {
  19363. $this->lockFile->write($lock);
  19364. $this->lockDataCache = null;
  19365. return true;
  19366. }
  19367. return false;
  19368. }
  19369. private function lockPackages(array $packages)
  19370. {
  19371. $locked = array();
  19372. foreach ($packages as $package) {
  19373. if ($package instanceof AliasPackage) {
  19374. continue;
  19375. }
  19376. $name = $package->getPrettyName();
  19377. $version = $package->getPrettyVersion();
  19378. if (!$name || !$version) {
  19379. throw new \LogicException(sprintf(
  19380. 'Package "%s" has no version or name and can not be locked',
  19381. $package
  19382. ));
  19383. }
  19384. $spec = $this->dumper->dump($package);
  19385. unset($spec['version_normalized']);
  19386. $time = isset($spec['time']) ? $spec['time'] : null;
  19387. unset($spec['time']);
  19388. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  19389. $time = $this->getPackageTime($package) ?: $time;
  19390. }
  19391. if (null !== $time) {
  19392. $spec['time'] = $time;
  19393. }
  19394. unset($spec['installation-source']);
  19395. $locked[] = $spec;
  19396. }
  19397. usort($locked, function ($a, $b) {
  19398. $comparison = strcmp($a['name'], $b['name']);
  19399. if (0 !== $comparison) {
  19400. return $comparison;
  19401. }
  19402. return strcmp($a['version'], $b['version']);
  19403. });
  19404. return $locked;
  19405. }
  19406. private function getPackageTime(PackageInterface $package)
  19407. {
  19408. if (!function_exists('proc_open')) {
  19409. return null;
  19410. }
  19411. $path = realpath($this->installationManager->getInstallPath($package));
  19412. $sourceType = $package->getSourceType();
  19413. $datetime = null;
  19414. if ($path && in_array($sourceType, array('git', 'hg'))) {
  19415. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  19416. switch ($sourceType) {
  19417. case 'git':
  19418. GitUtil::cleanEnv();
  19419. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  19420. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  19421. }
  19422. break;
  19423. case 'hg':
  19424. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  19425. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  19426. }
  19427. break;
  19428. }
  19429. }
  19430. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  19431. }
  19432. }
  19433. <?php
  19434. namespace Composer\Package;
  19435. use Composer\Package\Version\VersionParser;
  19436. use Composer\Util\ComposerMirror;
  19437. class Package extends BasePackage
  19438. {
  19439. protected $type;
  19440. protected $targetDir;
  19441. protected $installationSource;
  19442. protected $sourceType;
  19443. protected $sourceUrl;
  19444. protected $sourceReference;
  19445. protected $sourceMirrors;
  19446. protected $distType;
  19447. protected $distUrl;
  19448. protected $distReference;
  19449. protected $distSha1Checksum;
  19450. protected $distMirrors;
  19451. protected $version;
  19452. protected $prettyVersion;
  19453. protected $releaseDate;
  19454. protected $extra = array();
  19455. protected $binaries = array();
  19456. protected $dev;
  19457. protected $stability;
  19458. protected $notificationUrl;
  19459. protected $requires = array();
  19460. protected $conflicts = array();
  19461. protected $provides = array();
  19462. protected $replaces = array();
  19463. protected $devRequires = array();
  19464. protected $suggests = array();
  19465. protected $autoload = array();
  19466. protected $devAutoload = array();
  19467. protected $includePaths = array();
  19468. protected $archiveExcludes = array();
  19469. public function __construct($name, $version, $prettyVersion)
  19470. {
  19471. parent::__construct($name);
  19472. $this->version = $version;
  19473. $this->prettyVersion = $prettyVersion;
  19474. $this->stability = VersionParser::parseStability($version);
  19475. $this->dev = $this->stability === 'dev';
  19476. }
  19477. public function isDev()
  19478. {
  19479. return $this->dev;
  19480. }
  19481. public function setType($type)
  19482. {
  19483. $this->type = $type;
  19484. }
  19485. public function getType()
  19486. {
  19487. return $this->type ?: 'library';
  19488. }
  19489. public function getStability()
  19490. {
  19491. return $this->stability;
  19492. }
  19493. public function setTargetDir($targetDir)
  19494. {
  19495. $this->targetDir = $targetDir;
  19496. }
  19497. public function getTargetDir()
  19498. {
  19499. if (null === $this->targetDir) {
  19500. return;
  19501. }
  19502. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  19503. }
  19504. public function setExtra(array $extra)
  19505. {
  19506. $this->extra = $extra;
  19507. }
  19508. public function getExtra()
  19509. {
  19510. return $this->extra;
  19511. }
  19512. public function setBinaries(array $binaries)
  19513. {
  19514. $this->binaries = $binaries;
  19515. }
  19516. public function getBinaries()
  19517. {
  19518. return $this->binaries;
  19519. }
  19520. public function setInstallationSource($type)
  19521. {
  19522. $this->installationSource = $type;
  19523. }
  19524. public function getInstallationSource()
  19525. {
  19526. return $this->installationSource;
  19527. }
  19528. public function setSourceType($type)
  19529. {
  19530. $this->sourceType = $type;
  19531. }
  19532. public function getSourceType()
  19533. {
  19534. return $this->sourceType;
  19535. }
  19536. public function setSourceUrl($url)
  19537. {
  19538. $this->sourceUrl = $url;
  19539. }
  19540. public function getSourceUrl()
  19541. {
  19542. return $this->sourceUrl;
  19543. }
  19544. public function setSourceReference($reference)
  19545. {
  19546. $this->sourceReference = $reference;
  19547. }
  19548. public function getSourceReference()
  19549. {
  19550. return $this->sourceReference;
  19551. }
  19552. public function setSourceMirrors($mirrors)
  19553. {
  19554. $this->sourceMirrors = $mirrors;
  19555. }
  19556. public function getSourceMirrors()
  19557. {
  19558. return $this->sourceMirrors;
  19559. }
  19560. public function getSourceUrls()
  19561. {
  19562. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  19563. }
  19564. public function setDistType($type)
  19565. {
  19566. $this->distType = $type;
  19567. }
  19568. public function getDistType()
  19569. {
  19570. return $this->distType;
  19571. }
  19572. public function setDistUrl($url)
  19573. {
  19574. $this->distUrl = $url;
  19575. }
  19576. public function getDistUrl()
  19577. {
  19578. return $this->distUrl;
  19579. }
  19580. public function setDistReference($reference)
  19581. {
  19582. $this->distReference = $reference;
  19583. }
  19584. public function getDistReference()
  19585. {
  19586. return $this->distReference;
  19587. }
  19588. public function setDistSha1Checksum($sha1checksum)
  19589. {
  19590. $this->distSha1Checksum = $sha1checksum;
  19591. }
  19592. public function getDistSha1Checksum()
  19593. {
  19594. return $this->distSha1Checksum;
  19595. }
  19596. public function setDistMirrors($mirrors)
  19597. {
  19598. $this->distMirrors = $mirrors;
  19599. }
  19600. public function getDistMirrors()
  19601. {
  19602. return $this->distMirrors;
  19603. }
  19604. public function getDistUrls()
  19605. {
  19606. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  19607. }
  19608. public function getVersion()
  19609. {
  19610. return $this->version;
  19611. }
  19612. public function getPrettyVersion()
  19613. {
  19614. return $this->prettyVersion;
  19615. }
  19616. public function setReleaseDate(\DateTime $releaseDate)
  19617. {
  19618. $this->releaseDate = $releaseDate;
  19619. }
  19620. public function getReleaseDate()
  19621. {
  19622. return $this->releaseDate;
  19623. }
  19624. public function setRequires(array $requires)
  19625. {
  19626. $this->requires = $requires;
  19627. }
  19628. public function getRequires()
  19629. {
  19630. return $this->requires;
  19631. }
  19632. public function setConflicts(array $conflicts)
  19633. {
  19634. $this->conflicts = $conflicts;
  19635. }
  19636. public function getConflicts()
  19637. {
  19638. return $this->conflicts;
  19639. }
  19640. public function setProvides(array $provides)
  19641. {
  19642. $this->provides = $provides;
  19643. }
  19644. public function getProvides()
  19645. {
  19646. return $this->provides;
  19647. }
  19648. public function setReplaces(array $replaces)
  19649. {
  19650. $this->replaces = $replaces;
  19651. }
  19652. public function getReplaces()
  19653. {
  19654. return $this->replaces;
  19655. }
  19656. public function setDevRequires(array $devRequires)
  19657. {
  19658. $this->devRequires = $devRequires;
  19659. }
  19660. public function getDevRequires()
  19661. {
  19662. return $this->devRequires;
  19663. }
  19664. public function setSuggests(array $suggests)
  19665. {
  19666. $this->suggests = $suggests;
  19667. }
  19668. public function getSuggests()
  19669. {
  19670. return $this->suggests;
  19671. }
  19672. public function setAutoload(array $autoload)
  19673. {
  19674. $this->autoload = $autoload;
  19675. }
  19676. public function getAutoload()
  19677. {
  19678. return $this->autoload;
  19679. }
  19680. public function setDevAutoload(array $devAutoload)
  19681. {
  19682. $this->devAutoload = $devAutoload;
  19683. }
  19684. public function getDevAutoload()
  19685. {
  19686. return $this->devAutoload;
  19687. }
  19688. public function setIncludePaths(array $includePaths)
  19689. {
  19690. $this->includePaths = $includePaths;
  19691. }
  19692. public function getIncludePaths()
  19693. {
  19694. return $this->includePaths;
  19695. }
  19696. public function setNotificationUrl($notificationUrl)
  19697. {
  19698. $this->notificationUrl = $notificationUrl;
  19699. }
  19700. public function getNotificationUrl()
  19701. {
  19702. return $this->notificationUrl;
  19703. }
  19704. public function setArchiveExcludes(array $excludes)
  19705. {
  19706. $this->archiveExcludes = $excludes;
  19707. }
  19708. public function getArchiveExcludes()
  19709. {
  19710. return $this->archiveExcludes;
  19711. }
  19712. public function replaceVersion($version, $prettyVersion)
  19713. {
  19714. $this->version = $version;
  19715. $this->prettyVersion = $prettyVersion;
  19716. $this->stability = VersionParser::parseStability($version);
  19717. $this->dev = $this->stability === 'dev';
  19718. }
  19719. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  19720. {
  19721. if (!$url) {
  19722. return array();
  19723. }
  19724. $urls = array($url);
  19725. if ($mirrors) {
  19726. foreach ($mirrors as $mirror) {
  19727. if ($urlType === 'dist') {
  19728. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  19729. } elseif ($urlType === 'source' && $type === 'git') {
  19730. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  19731. } elseif ($urlType === 'source' && $type === 'hg') {
  19732. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  19733. }
  19734. if (!in_array($mirrorUrl, $urls)) {
  19735. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19736. $func($urls, $mirrorUrl);
  19737. }
  19738. }
  19739. }
  19740. return $urls;
  19741. }
  19742. }
  19743. <?php
  19744. namespace Composer\Package;
  19745. use Composer\Repository\RepositoryInterface;
  19746. interface PackageInterface
  19747. {
  19748. public function getName();
  19749. public function getPrettyName();
  19750. public function getNames();
  19751. public function setId($id);
  19752. public function getId();
  19753. public function isDev();
  19754. public function getType();
  19755. public function getTargetDir();
  19756. public function getExtra();
  19757. public function setInstallationSource($type);
  19758. public function getInstallationSource();
  19759. public function getSourceType();
  19760. public function getSourceUrl();
  19761. public function getSourceUrls();
  19762. public function getSourceReference();
  19763. public function getSourceMirrors();
  19764. public function getDistType();
  19765. public function getDistUrl();
  19766. public function getDistUrls();
  19767. public function getDistReference();
  19768. public function getDistSha1Checksum();
  19769. public function getDistMirrors();
  19770. public function getVersion();
  19771. public function getPrettyVersion();
  19772. public function getFullPrettyVersion($truncate = true);
  19773. public function getReleaseDate();
  19774. public function getStability();
  19775. public function getRequires();
  19776. public function getConflicts();
  19777. public function getProvides();
  19778. public function getReplaces();
  19779. public function getDevRequires();
  19780. public function getSuggests();
  19781. public function getAutoload();
  19782. public function getDevAutoload();
  19783. public function getIncludePaths();
  19784. public function setRepository(RepositoryInterface $repository);
  19785. public function getRepository();
  19786. public function getBinaries();
  19787. public function getUniqueName();
  19788. public function getNotificationUrl();
  19789. public function __toString();
  19790. public function getPrettyString();
  19791. public function getArchiveExcludes();
  19792. public function getTransportOptions();
  19793. public function setSourceReference($reference);
  19794. public function setDistUrl($url);
  19795. public function setDistType($type);
  19796. public function setDistReference($reference);
  19797. }
  19798. <?php
  19799. namespace Composer\Package;
  19800. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19801. {
  19802. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19803. {
  19804. parent::__construct($aliasOf, $version, $prettyVersion);
  19805. }
  19806. public function getAliases()
  19807. {
  19808. return $this->aliasOf->getAliases();
  19809. }
  19810. public function getMinimumStability()
  19811. {
  19812. return $this->aliasOf->getMinimumStability();
  19813. }
  19814. public function getStabilityFlags()
  19815. {
  19816. return $this->aliasOf->getStabilityFlags();
  19817. }
  19818. public function getReferences()
  19819. {
  19820. return $this->aliasOf->getReferences();
  19821. }
  19822. public function getPreferStable()
  19823. {
  19824. return $this->aliasOf->getPreferStable();
  19825. }
  19826. public function getConfig()
  19827. {
  19828. return $this->aliasOf->getConfig();
  19829. }
  19830. public function setRequires(array $require)
  19831. {
  19832. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19833. $this->aliasOf->setRequires($require);
  19834. }
  19835. public function setDevRequires(array $devRequire)
  19836. {
  19837. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19838. $this->aliasOf->setDevRequires($devRequire);
  19839. }
  19840. public function setConflicts(array $conflicts)
  19841. {
  19842. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19843. $this->aliasOf->setConflicts($conflicts);
  19844. }
  19845. public function setProvides(array $provides)
  19846. {
  19847. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19848. $this->aliasOf->setProvides($provides);
  19849. }
  19850. public function setReplaces(array $replaces)
  19851. {
  19852. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19853. $this->aliasOf->setReplaces($replaces);
  19854. }
  19855. public function setRepositories($repositories)
  19856. {
  19857. $this->aliasOf->setRepositories($repositories);
  19858. }
  19859. public function setAutoload(array $autoload)
  19860. {
  19861. $this->aliasOf->setAutoload($autoload);
  19862. }
  19863. public function setDevAutoload(array $devAutoload)
  19864. {
  19865. $this->aliasOf->setDevAutoload($devAutoload);
  19866. }
  19867. public function setStabilityFlags(array $stabilityFlags)
  19868. {
  19869. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19870. }
  19871. public function setSuggests(array $suggests)
  19872. {
  19873. $this->aliasOf->setSuggests($suggests);
  19874. }
  19875. public function setExtra(array $extra)
  19876. {
  19877. $this->aliasOf->setExtra($extra);
  19878. }
  19879. public function __clone()
  19880. {
  19881. parent::__clone();
  19882. $this->aliasOf = clone $this->aliasOf;
  19883. }
  19884. }
  19885. <?php
  19886. namespace Composer\Package;
  19887. class RootPackage extends CompletePackage implements RootPackageInterface
  19888. {
  19889. protected $minimumStability = 'stable';
  19890. protected $preferStable = false;
  19891. protected $stabilityFlags = array();
  19892. protected $config = array();
  19893. protected $references = array();
  19894. protected $aliases = array();
  19895. public function setMinimumStability($minimumStability)
  19896. {
  19897. $this->minimumStability = $minimumStability;
  19898. }
  19899. public function getMinimumStability()
  19900. {
  19901. return $this->minimumStability;
  19902. }
  19903. public function setStabilityFlags(array $stabilityFlags)
  19904. {
  19905. $this->stabilityFlags = $stabilityFlags;
  19906. }
  19907. public function getStabilityFlags()
  19908. {
  19909. return $this->stabilityFlags;
  19910. }
  19911. public function setPreferStable($preferStable)
  19912. {
  19913. $this->preferStable = $preferStable;
  19914. }
  19915. public function getPreferStable()
  19916. {
  19917. return $this->preferStable;
  19918. }
  19919. public function setConfig(array $config)
  19920. {
  19921. $this->config = $config;
  19922. }
  19923. public function getConfig()
  19924. {
  19925. return $this->config;
  19926. }
  19927. public function setReferences(array $references)
  19928. {
  19929. $this->references = $references;
  19930. }
  19931. public function getReferences()
  19932. {
  19933. return $this->references;
  19934. }
  19935. public function setAliases(array $aliases)
  19936. {
  19937. $this->aliases = $aliases;
  19938. }
  19939. public function getAliases()
  19940. {
  19941. return $this->aliases;
  19942. }
  19943. }
  19944. <?php
  19945. namespace Composer\Package;
  19946. interface RootPackageInterface extends CompletePackageInterface
  19947. {
  19948. public function getAliases();
  19949. public function getMinimumStability();
  19950. public function getStabilityFlags();
  19951. public function getReferences();
  19952. public function getPreferStable();
  19953. public function getConfig();
  19954. public function setRequires(array $requires);
  19955. public function setDevRequires(array $devRequires);
  19956. public function setConflicts(array $conflicts);
  19957. public function setProvides(array $provides);
  19958. public function setReplaces(array $replaces);
  19959. public function setRepositories($repositories);
  19960. public function setAutoload(array $autoload);
  19961. public function setDevAutoload(array $devAutoload);
  19962. public function setStabilityFlags(array $stabilityFlags);
  19963. public function setSuggests(array $suggests);
  19964. public function setExtra(array $extra);
  19965. }
  19966. <?php
  19967. namespace Composer\Package\Version;
  19968. use Composer\Config;
  19969. use Composer\Repository\Vcs\HgDriver;
  19970. use Composer\IO\NullIO;
  19971. use Composer\Semver\VersionParser as SemverVersionParser;
  19972. use Composer\Util\Git as GitUtil;
  19973. use Composer\Util\ProcessExecutor;
  19974. use Composer\Util\Svn as SvnUtil;
  19975. class VersionGuesser
  19976. {
  19977. private $config;
  19978. private $process;
  19979. private $versionParser;
  19980. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19981. {
  19982. $this->config = $config;
  19983. $this->process = $process;
  19984. $this->versionParser = $versionParser;
  19985. }
  19986. public function guessVersion(array $packageConfig, $path)
  19987. {
  19988. if (!function_exists('proc_open')) {
  19989. return null;
  19990. }
  19991. $versionData = $this->guessGitVersion($packageConfig, $path);
  19992. if (null !== $versionData && null !== $versionData['version']) {
  19993. return $this->postprocess($versionData);
  19994. }
  19995. $versionData = $this->guessHgVersion($packageConfig, $path);
  19996. if (null !== $versionData && null !== $versionData['version']) {
  19997. return $this->postprocess($versionData);
  19998. }
  19999. $versionData = $this->guessFossilVersion($packageConfig, $path);
  20000. if (null !== $versionData && null !== $versionData['version']) {
  20001. return $this->postprocess($versionData);
  20002. }
  20003. $versionData = $this->guessSvnVersion($packageConfig, $path);
  20004. if (null !== $versionData && null !== $versionData['version']) {
  20005. return $this->postprocess($versionData);
  20006. }
  20007. return null;
  20008. }
  20009. private function postprocess(array $versionData)
  20010. {
  20011. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['feature_pretty_version']) {
  20012. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  20013. }
  20014. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  20015. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  20016. }
  20017. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && preg_match('{\.9{7}}', $versionData['feature_version'])) {
  20018. $versionData['feature_pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  20019. }
  20020. return $versionData;
  20021. }
  20022. private function guessGitVersion(array $packageConfig, $path)
  20023. {
  20024. GitUtil::cleanEnv();
  20025. $commit = null;
  20026. $version = null;
  20027. $prettyVersion = null;
  20028. $featureVersion = null;
  20029. $featurePrettyVersion = null;
  20030. $isDetached = false;
  20031. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  20032. $branches = array();
  20033. $isFeatureBranch = false;
  20034. foreach ($this->process->splitLines($output) as $branch) {
  20035. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20036. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  20037. $version = 'dev-' . $match[2];
  20038. $prettyVersion = $version;
  20039. $isFeatureBranch = true;
  20040. $isDetached = true;
  20041. } else {
  20042. $version = $this->versionParser->normalizeBranch($match[1]);
  20043. $prettyVersion = 'dev-' . $match[1];
  20044. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20045. }
  20046. if ($match[2]) {
  20047. $commit = $match[2];
  20048. }
  20049. }
  20050. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  20051. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20052. $branches[] = $match[1];
  20053. }
  20054. }
  20055. }
  20056. if ($isFeatureBranch) {
  20057. $featureVersion = $version;
  20058. $featurePrettyVersion = $prettyVersion;
  20059. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  20060. $version = $result['version'];
  20061. $prettyVersion = $result['pretty_version'];
  20062. }
  20063. }
  20064. if (!$version || $isDetached) {
  20065. $result = $this->versionFromGitTags($path);
  20066. if ($result) {
  20067. $version = $result['version'];
  20068. $prettyVersion = $result['pretty_version'];
  20069. $featureVersion = null;
  20070. $featurePrettyVersion = null;
  20071. }
  20072. }
  20073. if (!$commit) {
  20074. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  20075. if (0 === $this->process->execute($command, $output, $path)) {
  20076. $commit = trim($output) ?: null;
  20077. }
  20078. }
  20079. if ($featureVersion) {
  20080. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);
  20081. }
  20082. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  20083. }
  20084. private function versionFromGitTags($path)
  20085. {
  20086. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  20087. try {
  20088. $version = $this->versionParser->normalize(trim($output));
  20089. return array('version' => $version, 'pretty_version' => trim($output));
  20090. } catch (\Exception $e) {
  20091. }
  20092. }
  20093. return null;
  20094. }
  20095. private function guessHgVersion(array $packageConfig, $path)
  20096. {
  20097. if (0 === $this->process->execute('hg branch', $output, $path)) {
  20098. $branch = trim($output);
  20099. $version = $this->versionParser->normalizeBranch($branch);
  20100. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20101. if ('9999999-dev' === $version) {
  20102. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  20103. }
  20104. if (!$isFeatureBranch) {
  20105. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  20106. }
  20107. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  20108. $branches = array_keys($driver->getBranches());
  20109. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  20110. $result['commit'] = '';
  20111. $result['feature_version'] = $version;
  20112. $result['feature_pretty_version'] = $version;
  20113. return $result;
  20114. }
  20115. }
  20116. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  20117. {
  20118. $prettyVersion = $version;
  20119. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  20120. || strpos(json_encode($packageConfig), '"self.version"')
  20121. ) {
  20122. $branch = preg_replace('{^dev-}', '', $version);
  20123. $length = PHP_INT_MAX;
  20124. $nonFeatureBranches = '';
  20125. if (!empty($packageConfig['non-feature-branches'])) {
  20126. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  20127. }
  20128. foreach ($branches as $candidate) {
  20129. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  20130. break;
  20131. }
  20132. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  20133. continue;
  20134. }
  20135. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  20136. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  20137. continue;
  20138. }
  20139. if (strlen($output) < $length) {
  20140. $length = strlen($output);
  20141. $version = $this->versionParser->normalizeBranch($candidate);
  20142. $prettyVersion = 'dev-' . $match[1];
  20143. }
  20144. }
  20145. }
  20146. return array('version' => $version, 'pretty_version' => $prettyVersion);
  20147. }
  20148. private function guessFossilVersion(array $packageConfig, $path)
  20149. {
  20150. $version = null;
  20151. $prettyVersion = null;
  20152. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  20153. $branch = trim($output);
  20154. $version = $this->versionParser->normalizeBranch($branch);
  20155. $prettyVersion = 'dev-' . $branch;
  20156. }
  20157. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  20158. try {
  20159. $version = $this->versionParser->normalize(trim($output));
  20160. $prettyVersion = trim($output);
  20161. } catch (\Exception $e) {
  20162. }
  20163. }
  20164. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20165. }
  20166. private function guessSvnVersion(array $packageConfig, $path)
  20167. {
  20168. SvnUtil::cleanEnv();
  20169. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  20170. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  20171. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  20172. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  20173. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  20174. if (preg_match($urlPattern, $output, $matches)) {
  20175. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  20176. $version = $this->versionParser->normalizeBranch($matches[3]);
  20177. $prettyVersion = 'dev-' . $matches[3];
  20178. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20179. }
  20180. $prettyVersion = trim($matches[1]);
  20181. $version = $this->versionParser->normalize($prettyVersion);
  20182. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20183. }
  20184. }
  20185. }
  20186. }
  20187. <?php
  20188. namespace Composer\Package\Version;
  20189. use Composer\Repository\PlatformRepository;
  20190. use Composer\Semver\VersionParser as SemverVersionParser;
  20191. use Composer\Semver\Semver;
  20192. class VersionParser extends SemverVersionParser
  20193. {
  20194. private static $constraints = array();
  20195. public function parseConstraints($constraints)
  20196. {
  20197. if (!isset(self::$constraints[$constraints])) {
  20198. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  20199. }
  20200. return self::$constraints[$constraints];
  20201. }
  20202. public function parseNameVersionPairs(array $pairs)
  20203. {
  20204. $pairs = array_values($pairs);
  20205. $result = array();
  20206. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  20207. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  20208. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  20209. $pair .= ' '.$pairs[$i + 1];
  20210. $i++;
  20211. }
  20212. if (strpos($pair, ' ')) {
  20213. list($name, $version) = explode(' ', $pair, 2);
  20214. $result[] = array('name' => $name, 'version' => $version);
  20215. } else {
  20216. $result[] = array('name' => $pair);
  20217. }
  20218. }
  20219. return $result;
  20220. }
  20221. public static function isUpgrade($normalizedFrom, $normalizedTo)
  20222. {
  20223. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  20224. return true;
  20225. }
  20226. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  20227. return $sorted[0] === $normalizedFrom;
  20228. }
  20229. }
  20230. <?php
  20231. namespace Composer\Package\Version;
  20232. use Composer\DependencyResolver\Pool;
  20233. use Composer\Package\BasePackage;
  20234. use Composer\Package\PackageInterface;
  20235. use Composer\Plugin\PluginInterface;
  20236. use Composer\Composer;
  20237. use Composer\Package\Loader\ArrayLoader;
  20238. use Composer\Package\Dumper\ArrayDumper;
  20239. use Composer\Semver\Constraint\Constraint;
  20240. class VersionSelector
  20241. {
  20242. private $pool;
  20243. private $parser;
  20244. public function __construct(Pool $pool)
  20245. {
  20246. $this->pool = $pool;
  20247. }
  20248. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  20249. {
  20250. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  20251. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  20252. if ($targetPhpVersion) {
  20253. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  20254. $composerRuntimeConstraint = new Constraint('==', $this->getParser()->normalize(Composer::RUNTIME_API_VERSION));
  20255. $composerPluginConstraint = new Constraint('==', $this->getParser()->normalize(PluginInterface::PLUGIN_API_VERSION));
  20256. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint, $composerPluginConstraint, $composerRuntimeConstraint) {
  20257. $reqs = $pkg->getRequires();
  20258. return (!isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint))
  20259. && (!isset($reqs['composer-plugin-api']) || $reqs['composer-plugin-api']->getConstraint()->matches($composerPluginConstraint))
  20260. && (!isset($reqs['composer-runtime-api']) || $reqs['composer-runtime-api']->getConstraint()->matches($composerRuntimeConstraint));
  20261. });
  20262. }
  20263. if (!$candidates) {
  20264. return false;
  20265. }
  20266. $package = reset($candidates);
  20267. $minPriority = BasePackage::$stabilities[$preferredStability];
  20268. foreach ($candidates as $candidate) {
  20269. $candidatePriority = $candidate->getStabilityPriority();
  20270. $currentPriority = $package->getStabilityPriority();
  20271. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  20272. continue;
  20273. }
  20274. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  20275. $package = $candidate;
  20276. continue;
  20277. }
  20278. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  20279. $package = $candidate;
  20280. continue;
  20281. }
  20282. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  20283. $package = $candidate;
  20284. }
  20285. }
  20286. return $package;
  20287. }
  20288. public function findRecommendedRequireVersion(PackageInterface $package)
  20289. {
  20290. $version = $package->getVersion();
  20291. if (!$package->isDev()) {
  20292. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  20293. }
  20294. $loader = new ArrayLoader($this->getParser());
  20295. $dumper = new ArrayDumper();
  20296. $extra = $loader->getBranchAlias($dumper->dump($package));
  20297. if ($extra) {
  20298. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  20299. if ($count) {
  20300. $extra = str_replace('.9999999', '.0', $extra);
  20301. return $this->transformVersion($extra, $extra, 'dev');
  20302. }
  20303. }
  20304. return $package->getPrettyVersion();
  20305. }
  20306. private function transformVersion($version, $prettyVersion, $stability)
  20307. {
  20308. $semanticVersionParts = explode('.', $version);
  20309. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  20310. if ($semanticVersionParts[0] === '0') {
  20311. unset($semanticVersionParts[3]);
  20312. } else {
  20313. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  20314. }
  20315. $version = implode('.', $semanticVersionParts);
  20316. } else {
  20317. return $prettyVersion;
  20318. }
  20319. if ($stability != 'stable') {
  20320. $version .= '@'.$stability;
  20321. }
  20322. return '^' . $version;
  20323. }
  20324. private function getParser()
  20325. {
  20326. if ($this->parser === null) {
  20327. $this->parser = new VersionParser();
  20328. }
  20329. return $this->parser;
  20330. }
  20331. }
  20332. <?php
  20333. namespace Composer\Plugin\Capability;
  20334. interface Capability
  20335. {
  20336. }
  20337. <?php
  20338. namespace Composer\Plugin\Capability;
  20339. interface CommandProvider extends Capability
  20340. {
  20341. public function getCommands();
  20342. }
  20343. <?php
  20344. namespace Composer\Plugin;
  20345. interface Capable
  20346. {
  20347. public function getCapabilities();
  20348. }
  20349. <?php
  20350. namespace Composer\Plugin;
  20351. use Composer\EventDispatcher\Event;
  20352. use Symfony\Component\Console\Input\InputInterface;
  20353. use Symfony\Component\Console\Output\OutputInterface;
  20354. class CommandEvent extends Event
  20355. {
  20356. private $commandName;
  20357. private $input;
  20358. private $output;
  20359. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  20360. {
  20361. parent::__construct($name, $args, $flags);
  20362. $this->commandName = $commandName;
  20363. $this->input = $input;
  20364. $this->output = $output;
  20365. }
  20366. public function getInput()
  20367. {
  20368. return $this->input;
  20369. }
  20370. public function getOutput()
  20371. {
  20372. return $this->output;
  20373. }
  20374. public function getCommandName()
  20375. {
  20376. return $this->commandName;
  20377. }
  20378. }
  20379. <?php
  20380. namespace Composer\Plugin;
  20381. class PluginEvents
  20382. {
  20383. const INIT = 'init';
  20384. const COMMAND = 'command';
  20385. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  20386. const PRE_COMMAND_RUN = 'pre-command-run';
  20387. }
  20388. <?php
  20389. namespace Composer\Plugin;
  20390. use Composer\Composer;
  20391. use Composer\IO\IOInterface;
  20392. interface PluginInterface
  20393. {
  20394. const PLUGIN_API_VERSION = '1.1.0';
  20395. public function activate(Composer $composer, IOInterface $io);
  20396. }
  20397. <?php
  20398. namespace Composer\Plugin;
  20399. use Composer\Composer;
  20400. use Composer\EventDispatcher\EventSubscriberInterface;
  20401. use Composer\IO\IOInterface;
  20402. use Composer\Package\CompletePackage;
  20403. use Composer\Package\Package;
  20404. use Composer\Package\Version\VersionParser;
  20405. use Composer\Repository\RepositoryInterface;
  20406. use Composer\Package\PackageInterface;
  20407. use Composer\Package\Link;
  20408. use Composer\Semver\Constraint\Constraint;
  20409. use Composer\DependencyResolver\Pool;
  20410. use Composer\Plugin\Capability\Capability;
  20411. use Composer\Util\PackageSorter;
  20412. class PluginManager
  20413. {
  20414. protected $composer;
  20415. protected $io;
  20416. protected $globalComposer;
  20417. protected $versionParser;
  20418. protected $disablePlugins = false;
  20419. protected $plugins = array();
  20420. protected $registeredPlugins = array();
  20421. private static $classCounter = 0;
  20422. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  20423. {
  20424. $this->io = $io;
  20425. $this->composer = $composer;
  20426. $this->globalComposer = $globalComposer;
  20427. $this->versionParser = new VersionParser();
  20428. $this->disablePlugins = $disablePlugins;
  20429. }
  20430. public function loadInstalledPlugins()
  20431. {
  20432. if ($this->disablePlugins) {
  20433. return;
  20434. }
  20435. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  20436. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20437. if ($repo) {
  20438. $this->loadRepository($repo);
  20439. }
  20440. if ($globalRepo) {
  20441. $this->loadRepository($globalRepo);
  20442. }
  20443. }
  20444. public function getPlugins()
  20445. {
  20446. return $this->plugins;
  20447. }
  20448. public function getGlobalComposer()
  20449. {
  20450. return $this->globalComposer;
  20451. }
  20452. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  20453. {
  20454. if ($this->disablePlugins) {
  20455. return;
  20456. }
  20457. if ($package->getType() === 'composer-plugin') {
  20458. $requiresComposer = null;
  20459. foreach ($package->getRequires() as $link) {
  20460. if ('composer-plugin-api' === $link->getTarget()) {
  20461. $requiresComposer = $link->getConstraint();
  20462. break;
  20463. }
  20464. }
  20465. if (!$requiresComposer) {
  20466. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  20467. }
  20468. $currentPluginApiVersion = $this->getPluginApiVersion();
  20469. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  20470. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  20471. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  20472. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  20473. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin 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>');
  20474. return;
  20475. }
  20476. }
  20477. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  20478. if (in_array($package->getName(), $this->registeredPlugins)) {
  20479. return;
  20480. }
  20481. $extra = $package->getExtra();
  20482. if (empty($extra['class'])) {
  20483. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  20484. }
  20485. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  20486. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  20487. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20488. $pool = new Pool('dev');
  20489. $pool->addRepository($localRepo);
  20490. if ($globalRepo) {
  20491. $pool->addRepository($globalRepo);
  20492. }
  20493. $autoloadPackages = array($package->getName() => $package);
  20494. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  20495. $generator = $this->composer->getAutoloadGenerator();
  20496. $autoloads = array();
  20497. foreach ($autoloadPackages as $autoloadPackage) {
  20498. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  20499. $autoloads[] = array($autoloadPackage, $downloadPath);
  20500. }
  20501. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  20502. $classLoader = $generator->createLoader($map);
  20503. $classLoader->register();
  20504. foreach ($classes as $class) {
  20505. if (class_exists($class, false)) {
  20506. $class = trim($class, '\\');
  20507. $path = $classLoader->findFile($class);
  20508. $code = file_get_contents($path);
  20509. $separatorPos = strrpos($class, '\\');
  20510. $className = $class;
  20511. if ($separatorPos) {
  20512. $className = substr($class, $separatorPos + 1);
  20513. }
  20514. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  20515. $code = str_replace('__FILE__', var_export($path, true), $code);
  20516. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  20517. $code = str_replace('__CLASS__', var_export($class, true), $code);
  20518. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  20519. eval($code);
  20520. $class .= '_composer_tmp'.self::$classCounter;
  20521. self::$classCounter++;
  20522. }
  20523. if ($oldInstallerPlugin) {
  20524. $installer = new $class($this->io, $this->composer);
  20525. $this->composer->getInstallationManager()->addInstaller($installer);
  20526. } elseif (class_exists($class)) {
  20527. $plugin = new $class();
  20528. $this->addPlugin($plugin);
  20529. $this->registeredPlugins[] = $package->getName();
  20530. } elseif ($failOnMissingClasses) {
  20531. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  20532. }
  20533. }
  20534. }
  20535. protected function getPluginApiVersion()
  20536. {
  20537. return PluginInterface::PLUGIN_API_VERSION;
  20538. }
  20539. public function addPlugin(PluginInterface $plugin)
  20540. {
  20541. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  20542. $this->plugins[] = $plugin;
  20543. $plugin->activate($this->composer, $this->io);
  20544. if ($plugin instanceof EventSubscriberInterface) {
  20545. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  20546. }
  20547. }
  20548. private function loadRepository(RepositoryInterface $repo)
  20549. {
  20550. $packages = $repo->getPackages();
  20551. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  20552. foreach ($sortedPackages as $package) {
  20553. if (!($package instanceof CompletePackage)) {
  20554. continue;
  20555. }
  20556. if ('composer-plugin' === $package->getType()) {
  20557. $this->registerPackage($package);
  20558. } elseif ('composer-installer' === $package->getType()) {
  20559. $this->registerPackage($package);
  20560. }
  20561. }
  20562. }
  20563. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  20564. {
  20565. $requires = array_merge(
  20566. $package->getRequires(),
  20567. $package->getDevRequires()
  20568. );
  20569. foreach ($requires as $requireLink) {
  20570. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  20571. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  20572. $collected[$requiredPackage->getName()] = $requiredPackage;
  20573. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  20574. }
  20575. }
  20576. return $collected;
  20577. }
  20578. private function lookupInstalledPackage(Pool $pool, Link $link)
  20579. {
  20580. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  20581. return !empty($packages) ? $packages[0] : null;
  20582. }
  20583. private function getInstallPath(PackageInterface $package, $global = false)
  20584. {
  20585. if (!$global) {
  20586. return $this->composer->getInstallationManager()->getInstallPath($package);
  20587. }
  20588. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  20589. }
  20590. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  20591. {
  20592. if (!($plugin instanceof Capable)) {
  20593. return null;
  20594. }
  20595. $capabilities = (array) $plugin->getCapabilities();
  20596. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  20597. return trim($capabilities[$capability]);
  20598. }
  20599. if (
  20600. array_key_exists($capability, $capabilities)
  20601. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  20602. ) {
  20603. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  20604. }
  20605. }
  20606. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  20607. {
  20608. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  20609. if (!class_exists($capabilityClass)) {
  20610. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  20611. }
  20612. $ctorArgs['plugin'] = $plugin;
  20613. $capabilityObj = new $capabilityClass($ctorArgs);
  20614. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  20615. throw new \RuntimeException(
  20616. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  20617. );
  20618. }
  20619. return $capabilityObj;
  20620. }
  20621. }
  20622. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  20623. {
  20624. $capabilities = array();
  20625. foreach ($this->getPlugins() as $plugin) {
  20626. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  20627. $capabilities[] = $capability;
  20628. }
  20629. }
  20630. return $capabilities;
  20631. }
  20632. }
  20633. <?php
  20634. namespace Composer\Plugin;
  20635. use Composer\EventDispatcher\Event;
  20636. use Symfony\Component\Console\Input\InputInterface;
  20637. class PreCommandRunEvent extends Event
  20638. {
  20639. private $input;
  20640. private $command;
  20641. public function __construct($name, InputInterface $input, $command)
  20642. {
  20643. parent::__construct($name);
  20644. $this->input = $input;
  20645. $this->command = $command;
  20646. }
  20647. public function getInput()
  20648. {
  20649. return $this->input;
  20650. }
  20651. public function getCommand()
  20652. {
  20653. return $this->command;
  20654. }
  20655. }
  20656. <?php
  20657. namespace Composer\Plugin;
  20658. use Composer\EventDispatcher\Event;
  20659. use Composer\Util\RemoteFilesystem;
  20660. class PreFileDownloadEvent extends Event
  20661. {
  20662. private $rfs;
  20663. private $processedUrl;
  20664. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  20665. {
  20666. parent::__construct($name);
  20667. $this->rfs = $rfs;
  20668. $this->processedUrl = $processedUrl;
  20669. }
  20670. public function getRemoteFilesystem()
  20671. {
  20672. return $this->rfs;
  20673. }
  20674. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  20675. {
  20676. $this->rfs = $rfs;
  20677. }
  20678. public function getProcessedUrl()
  20679. {
  20680. return $this->processedUrl;
  20681. }
  20682. }
  20683. <?php
  20684. namespace Composer\Question;
  20685. use Symfony\Component\Console\Exception\InvalidArgumentException;
  20686. use Symfony\Component\Console\Question\Question;
  20687. class StrictConfirmationQuestion extends Question
  20688. {
  20689. private $trueAnswerRegex;
  20690. private $falseAnswerRegex;
  20691. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  20692. {
  20693. parent::__construct($question, (bool) $default);
  20694. $this->trueAnswerRegex = $trueAnswerRegex;
  20695. $this->falseAnswerRegex = $falseAnswerRegex;
  20696. $this->setNormalizer($this->getDefaultNormalizer());
  20697. $this->setValidator($this->getDefaultValidator());
  20698. }
  20699. private function getDefaultNormalizer()
  20700. {
  20701. $default = $this->getDefault();
  20702. $trueRegex = $this->trueAnswerRegex;
  20703. $falseRegex = $this->falseAnswerRegex;
  20704. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  20705. if (is_bool($answer)) {
  20706. return $answer;
  20707. }
  20708. if (empty($answer) && !empty($default)) {
  20709. return $default;
  20710. }
  20711. if (preg_match($trueRegex, $answer)) {
  20712. return true;
  20713. }
  20714. if (preg_match($falseRegex, $answer)) {
  20715. return false;
  20716. }
  20717. return null;
  20718. };
  20719. }
  20720. private function getDefaultValidator()
  20721. {
  20722. return function ($answer) {
  20723. if (!is_bool($answer)) {
  20724. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  20725. }
  20726. return $answer;
  20727. };
  20728. }
  20729. }
  20730. <?php
  20731. namespace Composer\Repository;
  20732. use Composer\Package\AliasPackage;
  20733. use Composer\Package\PackageInterface;
  20734. use Composer\Package\CompletePackageInterface;
  20735. use Composer\Package\Version\VersionParser;
  20736. use Composer\Semver\Constraint\ConstraintInterface;
  20737. use Composer\Semver\Constraint\Constraint;
  20738. class ArrayRepository extends BaseRepository
  20739. {
  20740. protected $packages;
  20741. protected $packageMap;
  20742. public function __construct(array $packages = array())
  20743. {
  20744. foreach ($packages as $package) {
  20745. $this->addPackage($package);
  20746. }
  20747. }
  20748. public function findPackage($name, $constraint)
  20749. {
  20750. $name = strtolower($name);
  20751. if (!$constraint instanceof ConstraintInterface) {
  20752. $versionParser = new VersionParser();
  20753. $constraint = $versionParser->parseConstraints($constraint);
  20754. }
  20755. foreach ($this->getPackages() as $package) {
  20756. if ($name === $package->getName()) {
  20757. $pkgConstraint = new Constraint('==', $package->getVersion());
  20758. if ($constraint->matches($pkgConstraint)) {
  20759. return $package;
  20760. }
  20761. }
  20762. }
  20763. return null;
  20764. }
  20765. public function findPackages($name, $constraint = null)
  20766. {
  20767. $name = strtolower($name);
  20768. $packages = array();
  20769. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20770. $versionParser = new VersionParser();
  20771. $constraint = $versionParser->parseConstraints($constraint);
  20772. }
  20773. foreach ($this->getPackages() as $package) {
  20774. if ($name === $package->getName()) {
  20775. $pkgConstraint = new Constraint('==', $package->getVersion());
  20776. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20777. $packages[] = $package;
  20778. }
  20779. }
  20780. }
  20781. return $packages;
  20782. }
  20783. public function search($query, $mode = 0, $type = null)
  20784. {
  20785. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20786. $matches = array();
  20787. foreach ($this->getPackages() as $package) {
  20788. $name = $package->getName();
  20789. if (isset($matches[$name])) {
  20790. continue;
  20791. }
  20792. if (preg_match($regex, $name)
  20793. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20794. ) {
  20795. if (null !== $type && $package->getType() !== $type) {
  20796. continue;
  20797. }
  20798. $matches[$name] = array(
  20799. 'name' => $package->getPrettyName(),
  20800. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20801. );
  20802. }
  20803. }
  20804. return array_values($matches);
  20805. }
  20806. public function hasPackage(PackageInterface $package)
  20807. {
  20808. if ($this->packageMap === null) {
  20809. $this->packageMap = array();
  20810. foreach ($this->getPackages() as $repoPackage) {
  20811. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  20812. }
  20813. }
  20814. return isset($this->packageMap[$package->getUniqueName()]);
  20815. }
  20816. public function addPackage(PackageInterface $package)
  20817. {
  20818. if (null === $this->packages) {
  20819. $this->initialize();
  20820. }
  20821. $package->setRepository($this);
  20822. $this->packages[] = $package;
  20823. if ($package instanceof AliasPackage) {
  20824. $aliasedPackage = $package->getAliasOf();
  20825. if (null === $aliasedPackage->getRepository()) {
  20826. $this->addPackage($aliasedPackage);
  20827. }
  20828. }
  20829. $this->packageMap = null;
  20830. }
  20831. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20832. {
  20833. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20834. }
  20835. public function removePackage(PackageInterface $package)
  20836. {
  20837. $packageId = $package->getUniqueName();
  20838. foreach ($this->getPackages() as $key => $repoPackage) {
  20839. if ($packageId === $repoPackage->getUniqueName()) {
  20840. array_splice($this->packages, $key, 1);
  20841. $this->packageMap = null;
  20842. return;
  20843. }
  20844. }
  20845. }
  20846. public function getPackages()
  20847. {
  20848. if (null === $this->packages) {
  20849. $this->initialize();
  20850. }
  20851. return $this->packages;
  20852. }
  20853. public function count()
  20854. {
  20855. return count($this->packages);
  20856. }
  20857. protected function initialize()
  20858. {
  20859. $this->packages = array();
  20860. }
  20861. }
  20862. <?php
  20863. namespace Composer\Repository;
  20864. use Composer\IO\IOInterface;
  20865. use Composer\Json\JsonFile;
  20866. use Composer\Package\Loader\ArrayLoader;
  20867. use Composer\Package\Loader\LoaderInterface;
  20868. use Composer\Util\Zip;
  20869. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20870. {
  20871. protected $loader;
  20872. protected $lookup;
  20873. protected $repoConfig;
  20874. private $io;
  20875. public function __construct(array $repoConfig, IOInterface $io)
  20876. {
  20877. parent::__construct();
  20878. if (!extension_loaded('zip')) {
  20879. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20880. }
  20881. $this->loader = new ArrayLoader();
  20882. $this->lookup = $repoConfig['url'];
  20883. $this->io = $io;
  20884. $this->repoConfig = $repoConfig;
  20885. }
  20886. public function getRepoConfig()
  20887. {
  20888. return $this->repoConfig;
  20889. }
  20890. protected function initialize()
  20891. {
  20892. parent::initialize();
  20893. $this->scanDirectory($this->lookup);
  20894. }
  20895. private function scanDirectory($path)
  20896. {
  20897. $io = $this->io;
  20898. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20899. $iterator = new \RecursiveIteratorIterator($directory);
  20900. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20901. foreach ($regex as $file) {
  20902. if (!$file->isFile()) {
  20903. continue;
  20904. }
  20905. $package = $this->getComposerInformation($file);
  20906. if (!$package) {
  20907. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20908. continue;
  20909. }
  20910. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20911. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20912. $this->addPackage($package);
  20913. }
  20914. }
  20915. private function getComposerInformation(\SplFileInfo $file)
  20916. {
  20917. $json = Zip::getComposerJson($file->getPathname());
  20918. if (null === $json) {
  20919. return false;
  20920. }
  20921. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20922. $package['dist'] = array(
  20923. 'type' => 'zip',
  20924. 'url' => strtr($file->getPathname(), '\\', '/'),
  20925. 'shasum' => sha1_file($file->getRealPath()),
  20926. );
  20927. try {
  20928. $package = $this->loader->load($package);
  20929. } catch (\UnexpectedValueException $e) {
  20930. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20931. }
  20932. return $package;
  20933. }
  20934. }
  20935. <?php
  20936. namespace Composer\Repository;
  20937. use Composer\Package\RootPackageInterface;
  20938. use Composer\Semver\Constraint\ConstraintInterface;
  20939. use Composer\Semver\Constraint\Constraint;
  20940. use Composer\Package\Link;
  20941. abstract class BaseRepository implements RepositoryInterface
  20942. {
  20943. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20944. {
  20945. $needles = array_map('strtolower', (array) $needle);
  20946. $results = array();
  20947. if (null === $packagesFound) {
  20948. $packagesFound = $needles;
  20949. }
  20950. $rootPackage = null;
  20951. foreach ($this->getPackages() as $package) {
  20952. if ($package instanceof RootPackageInterface) {
  20953. $rootPackage = $package;
  20954. break;
  20955. }
  20956. }
  20957. foreach ($this->getPackages() as $package) {
  20958. $links = $package->getRequires();
  20959. $packagesInTree = $packagesFound;
  20960. if (!$invert) {
  20961. $links += $package->getReplaces();
  20962. foreach ($package->getReplaces() as $link) {
  20963. foreach ($needles as $needle) {
  20964. if ($link->getSource() === $needle) {
  20965. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20966. if (in_array($link->getTarget(), $packagesInTree)) {
  20967. $results[] = array($package, $link, false);
  20968. continue;
  20969. }
  20970. $packagesInTree[] = $link->getTarget();
  20971. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20972. $results[] = array($package, $link, $dependents);
  20973. $needles[] = $link->getTarget();
  20974. }
  20975. }
  20976. }
  20977. }
  20978. }
  20979. if ($package instanceof RootPackageInterface) {
  20980. $links += $package->getDevRequires();
  20981. }
  20982. foreach ($links as $link) {
  20983. foreach ($needles as $needle) {
  20984. if ($link->getTarget() === $needle) {
  20985. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20986. if (in_array($link->getSource(), $packagesInTree)) {
  20987. $results[] = array($package, $link, false);
  20988. continue;
  20989. }
  20990. $packagesInTree[] = $link->getSource();
  20991. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20992. $results[] = array($package, $link, $dependents);
  20993. }
  20994. }
  20995. }
  20996. }
  20997. if ($invert && in_array($package->getName(), $needles)) {
  20998. foreach ($package->getConflicts() as $link) {
  20999. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  21000. $version = new Constraint('=', $pkg->getVersion());
  21001. if ($link->getConstraint()->matches($version) === $invert) {
  21002. $results[] = array($package, $link, false);
  21003. }
  21004. }
  21005. }
  21006. }
  21007. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  21008. foreach ($package->getRequires() as $link) {
  21009. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  21010. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  21011. continue;
  21012. }
  21013. $platformPkg = $this->findPackage($link->getTarget(), '*');
  21014. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  21015. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  21016. continue;
  21017. }
  21018. foreach ($this->getPackages() as $pkg) {
  21019. if (!in_array($link->getTarget(), $pkg->getNames())) {
  21020. continue;
  21021. }
  21022. $version = new Constraint('=', $pkg->getVersion());
  21023. if (!$link->getConstraint()->matches($version)) {
  21024. if ($rootPackage) {
  21025. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  21026. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  21027. $results[] = array($package, $link, false);
  21028. $results[] = array($rootPackage, $rootReq, false);
  21029. continue 3;
  21030. }
  21031. }
  21032. $results[] = array($package, $link, false);
  21033. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  21034. } else {
  21035. $results[] = array($package, $link, false);
  21036. }
  21037. }
  21038. continue 2;
  21039. }
  21040. }
  21041. }
  21042. }
  21043. ksort($results);
  21044. return $results;
  21045. }
  21046. }
  21047. <?php
  21048. namespace Composer\Repository;
  21049. use Composer\Package\Loader\ArrayLoader;
  21050. use Composer\Package\PackageInterface;
  21051. use Composer\Package\AliasPackage;
  21052. use Composer\Package\Version\VersionParser;
  21053. use Composer\DependencyResolver\Pool;
  21054. use Composer\Json\JsonFile;
  21055. use Composer\Cache;
  21056. use Composer\Config;
  21057. use Composer\Composer;
  21058. use Composer\Factory;
  21059. use Composer\IO\IOInterface;
  21060. use Composer\Util\RemoteFilesystem;
  21061. use Composer\Plugin\PluginEvents;
  21062. use Composer\Plugin\PreFileDownloadEvent;
  21063. use Composer\EventDispatcher\EventDispatcher;
  21064. use Composer\Downloader\TransportException;
  21065. use Composer\Semver\Constraint\ConstraintInterface;
  21066. use Composer\Semver\Constraint\Constraint;
  21067. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21068. {
  21069. protected $config;
  21070. protected $repoConfig;
  21071. protected $options;
  21072. protected $url;
  21073. protected $baseUrl;
  21074. protected $io;
  21075. protected $rfs;
  21076. protected $cache;
  21077. protected $notifyUrl;
  21078. protected $searchUrl;
  21079. protected $hasProviders = false;
  21080. protected $providersUrl;
  21081. protected $lazyProvidersUrl;
  21082. protected $providerListing;
  21083. protected $providers = array();
  21084. protected $providersByUid = array();
  21085. protected $loader;
  21086. protected $rootAliases;
  21087. protected $allowSslDowngrade = false;
  21088. protected $eventDispatcher;
  21089. protected $sourceMirrors;
  21090. protected $distMirrors;
  21091. private $degradedMode = false;
  21092. private $rootData;
  21093. private $hasPartialPackages;
  21094. private $partialPackagesByName;
  21095. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21096. {
  21097. parent::__construct();
  21098. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  21099. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21100. }
  21101. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  21102. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  21103. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  21104. }
  21105. $urlBits = parse_url($repoConfig['url']);
  21106. if ($urlBits === false || empty($urlBits['scheme'])) {
  21107. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  21108. }
  21109. if (!isset($repoConfig['options'])) {
  21110. $repoConfig['options'] = array();
  21111. }
  21112. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  21113. $this->allowSslDowngrade = true;
  21114. }
  21115. $this->config = $config;
  21116. $this->options = $repoConfig['options'];
  21117. $this->url = $repoConfig['url'];
  21118. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  21119. $this->url = $match['proto'].'://repo.packagist.org';
  21120. }
  21121. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  21122. $this->io = $io;
  21123. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  21124. $this->loader = new ArrayLoader();
  21125. if ($rfs && $this->options) {
  21126. $rfs = clone $rfs;
  21127. $rfs->setOptions($this->options);
  21128. }
  21129. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  21130. $this->eventDispatcher = $eventDispatcher;
  21131. $this->repoConfig = $repoConfig;
  21132. }
  21133. public function getRepoConfig()
  21134. {
  21135. return $this->repoConfig;
  21136. }
  21137. public function setRootAliases(array $rootAliases)
  21138. {
  21139. $this->rootAliases = $rootAliases;
  21140. }
  21141. public function findPackage($name, $constraint)
  21142. {
  21143. if (!$this->hasProviders()) {
  21144. return parent::findPackage($name, $constraint);
  21145. }
  21146. $name = strtolower($name);
  21147. if (!$constraint instanceof ConstraintInterface) {
  21148. $versionParser = new VersionParser();
  21149. $constraint = $versionParser->parseConstraints($constraint);
  21150. }
  21151. foreach ($this->getProviderNames() as $providerName) {
  21152. if ($name === $providerName) {
  21153. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  21154. foreach ($packages as $package) {
  21155. if ($name === $package->getName()) {
  21156. $pkgConstraint = new Constraint('==', $package->getVersion());
  21157. if ($constraint->matches($pkgConstraint)) {
  21158. return $package;
  21159. }
  21160. }
  21161. }
  21162. break;
  21163. }
  21164. }
  21165. }
  21166. public function findPackages($name, $constraint = null)
  21167. {
  21168. if (!$this->hasProviders()) {
  21169. return parent::findPackages($name, $constraint);
  21170. }
  21171. $name = strtolower($name);
  21172. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  21173. $versionParser = new VersionParser();
  21174. $constraint = $versionParser->parseConstraints($constraint);
  21175. }
  21176. $packages = array();
  21177. foreach ($this->getProviderNames() as $providerName) {
  21178. if ($name === $providerName) {
  21179. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  21180. foreach ($candidates as $package) {
  21181. if ($name === $package->getName()) {
  21182. $pkgConstraint = new Constraint('==', $package->getVersion());
  21183. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  21184. $packages[] = $package;
  21185. }
  21186. }
  21187. }
  21188. break;
  21189. }
  21190. }
  21191. return $packages;
  21192. }
  21193. public function getPackages()
  21194. {
  21195. if ($this->hasProviders()) {
  21196. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  21197. }
  21198. return parent::getPackages();
  21199. }
  21200. public function search($query, $mode = 0, $type = null)
  21201. {
  21202. $this->loadRootServerFile();
  21203. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  21204. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  21205. $origin = RemoteFilesystem::getOrigin($url);
  21206. $json = $this->rfs->getContents($origin, $url, false);
  21207. $search = JsonFile::parseJson($json, $url);
  21208. if (empty($search['results'])) {
  21209. return array();
  21210. }
  21211. $results = array();
  21212. foreach ($search['results'] as $result) {
  21213. if (empty($result['virtual'])) {
  21214. $results[] = $result;
  21215. }
  21216. }
  21217. return $results;
  21218. }
  21219. if ($this->hasProviders()) {
  21220. $results = array();
  21221. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  21222. foreach ($this->getProviderNames() as $name) {
  21223. if (preg_match($regex, $name)) {
  21224. $results[] = array('name' => $name);
  21225. }
  21226. }
  21227. return $results;
  21228. }
  21229. return parent::search($query, $mode);
  21230. }
  21231. public function getProviderNames()
  21232. {
  21233. $this->loadRootServerFile();
  21234. if (null === $this->providerListing) {
  21235. $this->loadProviderListings($this->loadRootServerFile());
  21236. }
  21237. if ($this->hasPartialPackages) {
  21238. if (null === $this->partialPackagesByName) {
  21239. $this->initializePartialPackages();
  21240. }
  21241. return array_keys($this->partialPackagesByName);
  21242. }
  21243. if ($this->lazyProvidersUrl) {
  21244. return array();
  21245. }
  21246. if ($this->providersUrl) {
  21247. return array_keys($this->providerListing);
  21248. }
  21249. return array();
  21250. }
  21251. protected function configurePackageTransportOptions(PackageInterface $package)
  21252. {
  21253. foreach ($package->getDistUrls() as $url) {
  21254. if (strpos($url, $this->baseUrl) === 0) {
  21255. $package->setTransportOptions($this->options);
  21256. return;
  21257. }
  21258. }
  21259. }
  21260. public function hasProviders()
  21261. {
  21262. $this->loadRootServerFile();
  21263. return $this->hasProviders;
  21264. }
  21265. public function resetPackageIds()
  21266. {
  21267. foreach ($this->providersByUid as $package) {
  21268. if ($package instanceof AliasPackage) {
  21269. $package->getAliasOf()->setId(-1);
  21270. }
  21271. $package->setId(-1);
  21272. }
  21273. }
  21274. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  21275. {
  21276. if (isset($this->providers[$name]) && !$bypassFilters) {
  21277. return $this->providers[$name];
  21278. }
  21279. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  21280. $this->initializePartialPackages();
  21281. }
  21282. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  21283. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  21284. return array();
  21285. }
  21286. if (null === $this->providerListing) {
  21287. $this->loadProviderListings($this->loadRootServerFile());
  21288. }
  21289. $useLastModifiedCheck = false;
  21290. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  21291. $hash = null;
  21292. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  21293. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21294. $useLastModifiedCheck = true;
  21295. } elseif ($this->providersUrl) {
  21296. if (!isset($this->providerListing[$name])) {
  21297. return array();
  21298. }
  21299. $hash = $this->providerListing[$name]['sha256'];
  21300. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  21301. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21302. } else {
  21303. return array();
  21304. }
  21305. $packages = null;
  21306. if ($cacheKey) {
  21307. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  21308. $packages = json_decode($this->cache->read($cacheKey), true);
  21309. } elseif ($useLastModifiedCheck) {
  21310. if ($contents = $this->cache->read($cacheKey)) {
  21311. $contents = json_decode($contents, true);
  21312. if (isset($contents['last-modified'])) {
  21313. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  21314. if (true === $response) {
  21315. $packages = $contents;
  21316. } elseif ($response) {
  21317. $packages = $response;
  21318. }
  21319. }
  21320. }
  21321. }
  21322. }
  21323. if (!$packages) {
  21324. try {
  21325. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  21326. } catch (TransportException $e) {
  21327. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  21328. $packages = array('packages' => array());
  21329. } else {
  21330. throw $e;
  21331. }
  21332. }
  21333. }
  21334. $loadingPartialPackage = false;
  21335. } else {
  21336. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  21337. $loadingPartialPackage = true;
  21338. }
  21339. $this->providers[$name] = array();
  21340. foreach ($packages['packages'] as $versions) {
  21341. foreach ($versions as $version) {
  21342. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  21343. continue;
  21344. }
  21345. if (isset($this->providersByUid[$version['uid']])) {
  21346. if (!isset($this->providers[$name][$version['uid']])) {
  21347. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  21348. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  21349. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  21350. } else {
  21351. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  21352. }
  21353. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  21354. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  21355. }
  21356. }
  21357. } else {
  21358. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  21359. continue;
  21360. }
  21361. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  21362. $package->setRepository($this);
  21363. if ($package instanceof AliasPackage) {
  21364. $aliased = $package->getAliasOf();
  21365. $aliased->setRepository($this);
  21366. $this->providers[$name][$version['uid']] = $aliased;
  21367. $this->providers[$name][$version['uid'].'-alias'] = $package;
  21368. $this->providersByUid[$version['uid']] = $package;
  21369. } else {
  21370. $this->providers[$name][$version['uid']] = $package;
  21371. $this->providersByUid[$version['uid']] = $package;
  21372. }
  21373. unset($rootAliasData);
  21374. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  21375. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  21376. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  21377. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  21378. }
  21379. if (isset($rootAliasData)) {
  21380. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  21381. $alias->setRepository($this);
  21382. $this->providers[$name][$version['uid'].'-root'] = $alias;
  21383. $this->providersByUid[$version['uid'].'-root'] = $alias;
  21384. }
  21385. }
  21386. }
  21387. }
  21388. $result = $this->providers[$name];
  21389. if ($bypassFilters) {
  21390. foreach ($this->providers[$name] as $uid => $provider) {
  21391. unset($this->providersByUid[$uid]);
  21392. }
  21393. unset($this->providers[$name]);
  21394. }
  21395. return $result;
  21396. }
  21397. protected function initialize()
  21398. {
  21399. parent::initialize();
  21400. $repoData = $this->loadDataFromServer();
  21401. foreach ($repoData as $package) {
  21402. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  21403. }
  21404. }
  21405. public function addPackage(PackageInterface $package)
  21406. {
  21407. parent::addPackage($package);
  21408. $this->configurePackageTransportOptions($package);
  21409. }
  21410. protected function loadRootServerFile()
  21411. {
  21412. if (null !== $this->rootData) {
  21413. return $this->rootData;
  21414. }
  21415. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  21416. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  21417. }
  21418. $jsonUrlParts = parse_url($this->url);
  21419. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  21420. $jsonUrl = $this->url;
  21421. } else {
  21422. $jsonUrl = $this->url . '/packages.json';
  21423. }
  21424. $data = $this->fetchFile($jsonUrl, 'packages.json');
  21425. if (!empty($data['notify-batch'])) {
  21426. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  21427. } elseif (!empty($data['notify'])) {
  21428. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  21429. }
  21430. if (!empty($data['search'])) {
  21431. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  21432. }
  21433. if (!empty($data['mirrors'])) {
  21434. foreach ($data['mirrors'] as $mirror) {
  21435. if (!empty($mirror['git-url'])) {
  21436. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  21437. }
  21438. if (!empty($mirror['hg-url'])) {
  21439. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  21440. }
  21441. if (!empty($mirror['dist-url'])) {
  21442. $this->distMirrors[] = array(
  21443. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  21444. 'preferred' => !empty($mirror['preferred']),
  21445. );
  21446. }
  21447. }
  21448. }
  21449. if (!empty($data['providers-lazy-url'])) {
  21450. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  21451. $this->hasProviders = true;
  21452. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  21453. }
  21454. if ($this->allowSslDowngrade) {
  21455. $this->url = str_replace('https://', 'http://', $this->url);
  21456. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  21457. }
  21458. if (!empty($data['providers-url'])) {
  21459. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  21460. $this->hasProviders = true;
  21461. }
  21462. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  21463. $this->hasProviders = true;
  21464. }
  21465. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  21466. $this->url = 'https://repo.packagist.org';
  21467. $this->baseUrl = 'https://repo.packagist.org';
  21468. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  21469. $this->providersUrl = null;
  21470. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  21471. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  21472. $this->providersUrl = null;
  21473. }
  21474. return $this->rootData = $data;
  21475. }
  21476. protected function canonicalizeUrl($url)
  21477. {
  21478. if ('/' === $url[0]) {
  21479. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  21480. return $matches[0] . $url;
  21481. }
  21482. return $this->url;
  21483. }
  21484. return $url;
  21485. }
  21486. protected function loadDataFromServer()
  21487. {
  21488. $data = $this->loadRootServerFile();
  21489. return $this->loadIncludes($data);
  21490. }
  21491. protected function loadProviderListings($data)
  21492. {
  21493. if (isset($data['providers'])) {
  21494. if (!is_array($this->providerListing)) {
  21495. $this->providerListing = array();
  21496. }
  21497. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  21498. }
  21499. if ($this->providersUrl && isset($data['provider-includes'])) {
  21500. $includes = $data['provider-includes'];
  21501. foreach ($includes as $include => $metadata) {
  21502. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  21503. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  21504. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  21505. $includedData = json_decode($this->cache->read($cacheKey), true);
  21506. } else {
  21507. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  21508. }
  21509. $this->loadProviderListings($includedData);
  21510. }
  21511. }
  21512. }
  21513. protected function loadIncludes($data)
  21514. {
  21515. $packages = array();
  21516. if (!isset($data['packages']) && !isset($data['includes'])) {
  21517. foreach ($data as $pkg) {
  21518. foreach ($pkg['versions'] as $metadata) {
  21519. $packages[] = $metadata;
  21520. }
  21521. }
  21522. return $packages;
  21523. }
  21524. if (isset($data['packages'])) {
  21525. foreach ($data['packages'] as $package => $versions) {
  21526. foreach ($versions as $version => $metadata) {
  21527. $packages[] = $metadata;
  21528. }
  21529. }
  21530. }
  21531. if (isset($data['includes'])) {
  21532. foreach ($data['includes'] as $include => $metadata) {
  21533. if (isset($metadata['sha1']) && $this->cache->sha1($include) === $metadata['sha1']) {
  21534. $includedData = json_decode($this->cache->read($include), true);
  21535. } else {
  21536. $includedData = $this->fetchFile($include);
  21537. }
  21538. $packages = array_merge($packages, $this->loadIncludes($includedData));
  21539. }
  21540. }
  21541. return $packages;
  21542. }
  21543. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  21544. {
  21545. try {
  21546. if (!isset($data['notification-url'])) {
  21547. $data['notification-url'] = $this->notifyUrl;
  21548. }
  21549. $package = $this->loader->load($data, $class);
  21550. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  21551. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  21552. }
  21553. $package->setDistMirrors($this->distMirrors);
  21554. $this->configurePackageTransportOptions($package);
  21555. return $package;
  21556. } catch (\Exception $e) {
  21557. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  21558. }
  21559. }
  21560. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  21561. {
  21562. if (null === $cacheKey) {
  21563. $cacheKey = $filename;
  21564. $filename = $this->baseUrl.'/'.$filename;
  21565. }
  21566. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  21567. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  21568. }
  21569. $retries = 3;
  21570. while ($retries--) {
  21571. try {
  21572. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21573. if ($this->eventDispatcher) {
  21574. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21575. }
  21576. $origin = RemoteFilesystem::getOrigin($filename);
  21577. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21578. $json = $rfs->getContents($origin, $filename, false);
  21579. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  21580. if ($this->allowSslDowngrade) {
  21581. $this->url = str_replace('http://', 'https://', $this->url);
  21582. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  21583. $filename = str_replace('http://', 'https://', $filename);
  21584. }
  21585. if ($retries) {
  21586. usleep(100000);
  21587. continue;
  21588. }
  21589. 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.');
  21590. }
  21591. $data = JsonFile::parseJson($json, $filename);
  21592. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21593. if ($cacheKey) {
  21594. if ($storeLastModifiedTime) {
  21595. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21596. if ($lastModifiedDate) {
  21597. $data['last-modified'] = $lastModifiedDate;
  21598. $json = json_encode($data);
  21599. }
  21600. }
  21601. $this->cache->write($cacheKey, $json);
  21602. }
  21603. break;
  21604. } catch (\Exception $e) {
  21605. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21606. throw $e;
  21607. }
  21608. if ($retries) {
  21609. usleep(100000);
  21610. continue;
  21611. }
  21612. if ($e instanceof RepositorySecurityException) {
  21613. throw $e;
  21614. }
  21615. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  21616. if (!$this->degradedMode) {
  21617. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21618. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21619. }
  21620. $this->degradedMode = true;
  21621. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  21622. break;
  21623. }
  21624. throw $e;
  21625. }
  21626. }
  21627. return $data;
  21628. }
  21629. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  21630. {
  21631. $retries = 3;
  21632. while ($retries--) {
  21633. try {
  21634. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21635. if ($this->eventDispatcher) {
  21636. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21637. }
  21638. $origin = RemoteFilesystem::getOrigin($filename);
  21639. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21640. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  21641. $json = $rfs->getContents($origin, $filename, false, $options);
  21642. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  21643. return true;
  21644. }
  21645. $data = JsonFile::parseJson($json, $filename);
  21646. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21647. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21648. if ($lastModifiedDate) {
  21649. $data['last-modified'] = $lastModifiedDate;
  21650. $json = json_encode($data);
  21651. }
  21652. $this->cache->write($cacheKey, $json);
  21653. return $data;
  21654. } catch (\Exception $e) {
  21655. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21656. throw $e;
  21657. }
  21658. if ($retries) {
  21659. usleep(100000);
  21660. continue;
  21661. }
  21662. if (!$this->degradedMode) {
  21663. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21664. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21665. }
  21666. $this->degradedMode = true;
  21667. return true;
  21668. }
  21669. }
  21670. }
  21671. private function initializePartialPackages()
  21672. {
  21673. $rootData = $this->loadRootServerFile();
  21674. $this->partialPackagesByName = array();
  21675. foreach ($rootData['packages'] as $package => $versions) {
  21676. $package = strtolower($package);
  21677. foreach ($versions as $version) {
  21678. $this->partialPackagesByName[$package][] = $version;
  21679. if (!empty($version['provide']) && is_array($version['provide'])) {
  21680. foreach ($version['provide'] as $provided => $providedVersion) {
  21681. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21682. }
  21683. }
  21684. if (!empty($version['replace']) && is_array($version['replace'])) {
  21685. foreach ($version['replace'] as $provided => $providedVersion) {
  21686. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21687. }
  21688. }
  21689. }
  21690. }
  21691. $this->rootData = true;
  21692. }
  21693. }
  21694. <?php
  21695. namespace Composer\Repository;
  21696. use Composer\Package\PackageInterface;
  21697. class CompositeRepository extends BaseRepository
  21698. {
  21699. private $repositories;
  21700. public function __construct(array $repositories)
  21701. {
  21702. $this->repositories = array();
  21703. foreach ($repositories as $repo) {
  21704. $this->addRepository($repo);
  21705. }
  21706. }
  21707. public function getRepositories()
  21708. {
  21709. return $this->repositories;
  21710. }
  21711. public function hasPackage(PackageInterface $package)
  21712. {
  21713. foreach ($this->repositories as $repository) {
  21714. if ($repository->hasPackage($package)) {
  21715. return true;
  21716. }
  21717. }
  21718. return false;
  21719. }
  21720. public function findPackage($name, $constraint)
  21721. {
  21722. foreach ($this->repositories as $repository) {
  21723. $package = $repository->findPackage($name, $constraint);
  21724. if (null !== $package) {
  21725. return $package;
  21726. }
  21727. }
  21728. return null;
  21729. }
  21730. public function findPackages($name, $constraint = null)
  21731. {
  21732. $packages = array();
  21733. foreach ($this->repositories as $repository) {
  21734. $packages[] = $repository->findPackages($name, $constraint);
  21735. }
  21736. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21737. }
  21738. public function search($query, $mode = 0, $type = null)
  21739. {
  21740. $matches = array();
  21741. foreach ($this->repositories as $repository) {
  21742. $matches[] = $repository->search($query, $mode, $type);
  21743. }
  21744. return $matches ? call_user_func_array('array_merge', $matches) : array();
  21745. }
  21746. public function getPackages()
  21747. {
  21748. $packages = array();
  21749. foreach ($this->repositories as $repository) {
  21750. $packages[] = $repository->getPackages();
  21751. }
  21752. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21753. }
  21754. public function removePackage(PackageInterface $package)
  21755. {
  21756. foreach ($this->repositories as $repository) {
  21757. $repository->removePackage($package);
  21758. }
  21759. }
  21760. public function count()
  21761. {
  21762. $total = 0;
  21763. foreach ($this->repositories as $repository) {
  21764. $total += $repository->count();
  21765. }
  21766. return $total;
  21767. }
  21768. public function addRepository(RepositoryInterface $repository)
  21769. {
  21770. if ($repository instanceof self) {
  21771. foreach ($repository->getRepositories() as $repo) {
  21772. $this->addRepository($repo);
  21773. }
  21774. } else {
  21775. $this->repositories[] = $repository;
  21776. }
  21777. }
  21778. }
  21779. <?php
  21780. namespace Composer\Repository;
  21781. interface ConfigurableRepositoryInterface
  21782. {
  21783. public function getRepoConfig();
  21784. }
  21785. <?php
  21786. namespace Composer\Repository;
  21787. use Composer\Json\JsonFile;
  21788. use Composer\Package\Loader\ArrayLoader;
  21789. use Composer\Package\Dumper\ArrayDumper;
  21790. class FilesystemRepository extends WritableArrayRepository
  21791. {
  21792. private $file;
  21793. public function __construct(JsonFile $repositoryFile)
  21794. {
  21795. parent::__construct();
  21796. $this->file = $repositoryFile;
  21797. }
  21798. protected function initialize()
  21799. {
  21800. parent::initialize();
  21801. if (!$this->file->exists()) {
  21802. return;
  21803. }
  21804. try {
  21805. $packages = $this->file->read();
  21806. if (isset($packages['packages'])) {
  21807. $packages = $packages['packages'];
  21808. }
  21809. if (!is_array($packages)) {
  21810. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21811. }
  21812. } catch (\Exception $e) {
  21813. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21814. }
  21815. $loader = new ArrayLoader(null, true);
  21816. foreach ($packages as $packageData) {
  21817. $package = $loader->load($packageData);
  21818. $this->addPackage($package);
  21819. }
  21820. }
  21821. public function reload()
  21822. {
  21823. $this->packages = null;
  21824. $this->initialize();
  21825. }
  21826. public function write()
  21827. {
  21828. $data = array();
  21829. $dumper = new ArrayDumper();
  21830. foreach ($this->getCanonicalPackages() as $package) {
  21831. $data[] = $dumper->dump($package);
  21832. }
  21833. usort($data, function ($a, $b) {
  21834. return strcmp($a['name'], $b['name']);
  21835. });
  21836. $this->file->write($data);
  21837. }
  21838. }
  21839. <?php
  21840. namespace Composer\Repository;
  21841. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21842. {
  21843. }
  21844. <?php
  21845. namespace Composer\Repository;
  21846. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21847. {
  21848. }
  21849. <?php
  21850. namespace Composer\Repository;
  21851. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21852. {
  21853. }
  21854. <?php
  21855. namespace Composer\Repository;
  21856. class InvalidRepositoryException extends \Exception
  21857. {
  21858. }
  21859. <?php
  21860. namespace Composer\Repository;
  21861. use Composer\Package\Loader\ArrayLoader;
  21862. use Composer\Package\Loader\ValidatingArrayLoader;
  21863. class PackageRepository extends ArrayRepository
  21864. {
  21865. private $config;
  21866. public function __construct(array $config)
  21867. {
  21868. parent::__construct();
  21869. $this->config = $config['package'];
  21870. if (!is_numeric(key($this->config))) {
  21871. $this->config = array($this->config);
  21872. }
  21873. }
  21874. protected function initialize()
  21875. {
  21876. parent::initialize();
  21877. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21878. foreach ($this->config as $package) {
  21879. try {
  21880. $package = $loader->load($package);
  21881. } catch (\Exception $e) {
  21882. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21883. }
  21884. $this->addPackage($package);
  21885. }
  21886. }
  21887. }
  21888. <?php
  21889. namespace Composer\Repository;
  21890. use Composer\Config;
  21891. use Composer\IO\IOInterface;
  21892. use Composer\Json\JsonFile;
  21893. use Composer\Package\Loader\ArrayLoader;
  21894. use Composer\Package\Version\VersionGuesser;
  21895. use Composer\Package\Version\VersionParser;
  21896. use Composer\Util\Platform;
  21897. use Composer\Util\ProcessExecutor;
  21898. use Composer\Util\Filesystem;
  21899. use Composer\Util\Git as GitUtil;
  21900. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21901. {
  21902. private $loader;
  21903. private $versionGuesser;
  21904. private $url;
  21905. private $repoConfig;
  21906. private $process;
  21907. private $options;
  21908. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21909. {
  21910. if (!isset($repoConfig['url'])) {
  21911. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21912. }
  21913. $this->loader = new ArrayLoader(null, true);
  21914. $this->url = Platform::expandPath($repoConfig['url']);
  21915. $this->process = new ProcessExecutor($io);
  21916. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21917. $this->repoConfig = $repoConfig;
  21918. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21919. if (!isset($this->options['relative'])) {
  21920. $filesystem = new Filesystem();
  21921. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  21922. }
  21923. parent::__construct();
  21924. }
  21925. public function getRepoConfig()
  21926. {
  21927. return $this->repoConfig;
  21928. }
  21929. protected function initialize()
  21930. {
  21931. parent::initialize();
  21932. $urlMatches = $this->getUrlMatches();
  21933. if (empty($urlMatches)) {
  21934. if (preg_match('{[*{}]}', $this->url)) {
  21935. $url = $this->url;
  21936. while (preg_match('{[*{}]}', $url)) {
  21937. $url = dirname($url);
  21938. }
  21939. if (is_dir($url)) {
  21940. return;
  21941. }
  21942. }
  21943. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  21944. }
  21945. foreach ($urlMatches as $url) {
  21946. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21947. $composerFilePath = $path.'composer.json';
  21948. if (!file_exists($composerFilePath)) {
  21949. continue;
  21950. }
  21951. $json = file_get_contents($composerFilePath);
  21952. $package = JsonFile::parseJson($json, $composerFilePath);
  21953. $package['dist'] = array(
  21954. 'type' => 'path',
  21955. 'url' => $url,
  21956. 'reference' => sha1($json . serialize($this->options)),
  21957. );
  21958. $package['transport-options'] = $this->options;
  21959. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21960. if (
  21961. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21962. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21963. && $ref1 === $ref2
  21964. ) {
  21965. $package['version'] = $rootVersion;
  21966. }
  21967. }
  21968. $output = '';
  21969. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  21970. $package['dist']['reference'] = trim($output);
  21971. }
  21972. if (!isset($package['version'])) {
  21973. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21974. if (is_array($versionData) && $versionData['pretty_version']) {
  21975. if (!empty($versionData['feature_pretty_version'])) {
  21976. $package['version'] = $versionData['feature_pretty_version'];
  21977. $this->addPackage($this->loader->load($package));
  21978. }
  21979. $package['version'] = $versionData['pretty_version'];
  21980. } else {
  21981. $package['version'] = 'dev-master';
  21982. }
  21983. }
  21984. $package = $this->loader->load($package);
  21985. $this->addPackage($package);
  21986. }
  21987. }
  21988. private function getUrlMatches()
  21989. {
  21990. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21991. if (defined('GLOB_BRACE')) {
  21992. $flags |= GLOB_BRACE;
  21993. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21994. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21995. }
  21996. return array_map(function ($val) {
  21997. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21998. }, glob($this->url, $flags));
  21999. }
  22000. }
  22001. <?php
  22002. namespace Composer\Repository\Pear;
  22003. use Composer\Util\RemoteFilesystem;
  22004. abstract class BaseChannelReader
  22005. {
  22006. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  22007. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  22008. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  22009. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  22010. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  22011. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  22012. private $rfs;
  22013. protected function __construct(RemoteFilesystem $rfs)
  22014. {
  22015. $this->rfs = $rfs;
  22016. }
  22017. protected function requestContent($origin, $path)
  22018. {
  22019. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  22020. $content = $this->rfs->getContents($origin, $url, false);
  22021. if (!$content) {
  22022. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  22023. }
  22024. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  22025. }
  22026. protected function requestXml($origin, $path)
  22027. {
  22028. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  22029. if (false === $xml) {
  22030. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  22031. }
  22032. return $xml;
  22033. }
  22034. }
  22035. <?php
  22036. namespace Composer\Repository\Pear;
  22037. class ChannelInfo
  22038. {
  22039. private $name;
  22040. private $alias;
  22041. private $packages;
  22042. public function __construct($name, $alias, array $packages)
  22043. {
  22044. $this->name = $name;
  22045. $this->alias = $alias;
  22046. $this->packages = $packages;
  22047. }
  22048. public function getName()
  22049. {
  22050. return $this->name;
  22051. }
  22052. public function getAlias()
  22053. {
  22054. return $this->alias;
  22055. }
  22056. public function getPackages()
  22057. {
  22058. return $this->packages;
  22059. }
  22060. }
  22061. <?php
  22062. namespace Composer\Repository\Pear;
  22063. use Composer\Util\RemoteFilesystem;
  22064. class ChannelReader extends BaseChannelReader
  22065. {
  22066. private $readerMap;
  22067. public function __construct(RemoteFilesystem $rfs)
  22068. {
  22069. parent::__construct($rfs);
  22070. $rest10reader = new ChannelRest10Reader($rfs);
  22071. $rest11reader = new ChannelRest11Reader($rfs);
  22072. $this->readerMap = array(
  22073. 'REST1.3' => $rest11reader,
  22074. 'REST1.2' => $rest11reader,
  22075. 'REST1.1' => $rest11reader,
  22076. 'REST1.0' => $rest10reader,
  22077. );
  22078. }
  22079. public function read($url)
  22080. {
  22081. $xml = $this->requestXml($url, "/channel.xml");
  22082. $channelName = (string) $xml->name;
  22083. $channelAlias = (string) $xml->suggestedalias;
  22084. $supportedVersions = array_keys($this->readerMap);
  22085. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  22086. if (!$selectedRestVersion) {
  22087. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  22088. }
  22089. $reader = $this->readerMap[$selectedRestVersion['version']];
  22090. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  22091. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  22092. }
  22093. private function selectRestVersion($channelXml, $supportedVersions)
  22094. {
  22095. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  22096. foreach ($supportedVersions as $version) {
  22097. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  22098. $testResult = $channelXml->xpath($xpathTest);
  22099. foreach ($testResult as $result) {
  22100. $result = (string) $result;
  22101. if (preg_match('{^https://}i', $result)) {
  22102. return array('version' => $version, 'baseUrl' => $result);
  22103. }
  22104. }
  22105. if (count($testResult) > 0) {
  22106. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  22107. }
  22108. }
  22109. return null;
  22110. }
  22111. }
  22112. <?php
  22113. namespace Composer\Repository\Pear;
  22114. use Composer\Downloader\TransportException;
  22115. class ChannelRest10Reader extends BaseChannelReader
  22116. {
  22117. private $dependencyReader;
  22118. public function __construct($rfs)
  22119. {
  22120. parent::__construct($rfs);
  22121. $this->dependencyReader = new PackageDependencyParser();
  22122. }
  22123. public function read($baseUrl)
  22124. {
  22125. return $this->readPackages($baseUrl);
  22126. }
  22127. private function readPackages($baseUrl)
  22128. {
  22129. $result = array();
  22130. $xmlPath = '/p/packages.xml';
  22131. $xml = $this->requestXml($baseUrl, $xmlPath);
  22132. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  22133. foreach ($xml->xpath('ns:p') as $node) {
  22134. $packageName = (string) $node;
  22135. $packageInfo = $this->readPackage($baseUrl, $packageName);
  22136. $result[] = $packageInfo;
  22137. }
  22138. return $result;
  22139. }
  22140. private function readPackage($baseUrl, $packageName)
  22141. {
  22142. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  22143. $xml = $this->requestXml($baseUrl, $xmlPath);
  22144. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  22145. $channelName = (string) $xml->c;
  22146. $packageName = (string) $xml->n;
  22147. $license = (string) $xml->l;
  22148. $shortDescription = (string) $xml->s;
  22149. $description = (string) $xml->d;
  22150. return new PackageInfo(
  22151. $channelName,
  22152. $packageName,
  22153. $license,
  22154. $shortDescription,
  22155. $description,
  22156. $this->readPackageReleases($baseUrl, $packageName)
  22157. );
  22158. }
  22159. private function readPackageReleases($baseUrl, $packageName)
  22160. {
  22161. $result = array();
  22162. try {
  22163. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  22164. $xml = $this->requestXml($baseUrl, $xmlPath);
  22165. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  22166. foreach ($xml->xpath('ns:r') as $node) {
  22167. $releaseVersion = (string) $node->v;
  22168. $releaseStability = (string) $node->s;
  22169. try {
  22170. $result[$releaseVersion] = new ReleaseInfo(
  22171. $releaseStability,
  22172. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  22173. );
  22174. } catch (TransportException $exception) {
  22175. if ($exception->getCode() != 404) {
  22176. throw $exception;
  22177. }
  22178. }
  22179. }
  22180. } catch (TransportException $exception) {
  22181. if ($exception->getCode() != 404) {
  22182. throw $exception;
  22183. }
  22184. }
  22185. return $result;
  22186. }
  22187. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  22188. {
  22189. $dependencyReader = new PackageDependencyParser();
  22190. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  22191. $content = $this->requestContent($baseUrl, $depthPath);
  22192. $dependencyArray = unserialize($content);
  22193. return $dependencyReader->buildDependencyInfo($dependencyArray);
  22194. }
  22195. }
  22196. <?php
  22197. namespace Composer\Repository\Pear;
  22198. class ChannelRest11Reader extends BaseChannelReader
  22199. {
  22200. private $dependencyReader;
  22201. public function __construct($rfs)
  22202. {
  22203. parent::__construct($rfs);
  22204. $this->dependencyReader = new PackageDependencyParser();
  22205. }
  22206. public function read($baseUrl)
  22207. {
  22208. return $this->readChannelPackages($baseUrl);
  22209. }
  22210. private function readChannelPackages($baseUrl)
  22211. {
  22212. $result = array();
  22213. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  22214. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  22215. foreach ($xml->xpath('ns:c') as $node) {
  22216. $categoryName = (string) $node;
  22217. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  22218. $result = array_merge($result, $categoryPackages);
  22219. }
  22220. return $result;
  22221. }
  22222. private function readCategoryPackages($baseUrl, $categoryName)
  22223. {
  22224. $result = array();
  22225. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  22226. $xml = $this->requestXml($baseUrl, $categoryPath);
  22227. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22228. foreach ($xml->xpath('ns:pi') as $node) {
  22229. $packageInfo = $this->parsePackage($node);
  22230. $result[] = $packageInfo;
  22231. }
  22232. return $result;
  22233. }
  22234. private function parsePackage($packageInfo)
  22235. {
  22236. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22237. $channelName = (string) $packageInfo->p->c;
  22238. $packageName = (string) $packageInfo->p->n;
  22239. $license = (string) $packageInfo->p->l;
  22240. $shortDescription = (string) $packageInfo->p->s;
  22241. $description = (string) $packageInfo->p->d;
  22242. $dependencies = array();
  22243. foreach ($packageInfo->xpath('ns:deps') as $node) {
  22244. $dependencyVersion = (string) $node->v;
  22245. $dependencyArray = unserialize((string) $node->d);
  22246. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  22247. $dependencies[$dependencyVersion] = $dependencyInfo;
  22248. }
  22249. $releases = array();
  22250. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  22251. if ($releasesInfo) {
  22252. foreach ($releasesInfo as $node) {
  22253. $releaseVersion = (string) $node->v;
  22254. $releaseStability = (string) $node->s;
  22255. $releases[$releaseVersion] = new ReleaseInfo(
  22256. $releaseStability,
  22257. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  22258. );
  22259. }
  22260. }
  22261. return new PackageInfo(
  22262. $channelName,
  22263. $packageName,
  22264. $license,
  22265. $shortDescription,
  22266. $description,
  22267. $releases
  22268. );
  22269. }
  22270. }
  22271. <?php
  22272. namespace Composer\Repository\Pear;
  22273. class DependencyConstraint
  22274. {
  22275. private $type;
  22276. private $constraint;
  22277. private $channelName;
  22278. private $packageName;
  22279. public function __construct($type, $constraint, $channelName, $packageName)
  22280. {
  22281. $this->type = $type;
  22282. $this->constraint = $constraint;
  22283. $this->channelName = $channelName;
  22284. $this->packageName = $packageName;
  22285. }
  22286. public function getChannelName()
  22287. {
  22288. return $this->channelName;
  22289. }
  22290. public function getConstraint()
  22291. {
  22292. return $this->constraint;
  22293. }
  22294. public function getPackageName()
  22295. {
  22296. return $this->packageName;
  22297. }
  22298. public function getType()
  22299. {
  22300. return $this->type;
  22301. }
  22302. }
  22303. <?php
  22304. namespace Composer\Repository\Pear;
  22305. class DependencyInfo
  22306. {
  22307. private $requires;
  22308. private $optionals;
  22309. public function __construct($requires, $optionals)
  22310. {
  22311. $this->requires = $requires;
  22312. $this->optionals = $optionals;
  22313. }
  22314. public function getRequires()
  22315. {
  22316. return $this->requires;
  22317. }
  22318. public function getOptionals()
  22319. {
  22320. return $this->optionals;
  22321. }
  22322. }
  22323. <?php
  22324. namespace Composer\Repository\Pear;
  22325. class PackageDependencyParser
  22326. {
  22327. public function buildDependencyInfo($depArray)
  22328. {
  22329. if (!is_array($depArray)) {
  22330. return new DependencyInfo(array(), array());
  22331. }
  22332. if (!$this->isHash($depArray)) {
  22333. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  22334. }
  22335. return $this->buildDependency20Info($depArray);
  22336. }
  22337. private function buildDependency10Info($depArray)
  22338. {
  22339. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  22340. $result = array();
  22341. foreach ($depArray as $depItem) {
  22342. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  22343. continue;
  22344. }
  22345. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  22346. ? 'optional'
  22347. : 'required';
  22348. $depType = 'not' == $depItem['rel']
  22349. ? 'conflicts'
  22350. : $depType;
  22351. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  22352. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  22353. ? '*'
  22354. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  22355. switch ($depItem['type']) {
  22356. case 'php':
  22357. $depChannelName = 'php';
  22358. $depPackageName = '';
  22359. break;
  22360. case 'pkg':
  22361. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  22362. $depPackageName = $depItem['name'];
  22363. break;
  22364. case 'ext':
  22365. $depChannelName = 'ext';
  22366. $depPackageName = $depItem['name'];
  22367. break;
  22368. case 'os':
  22369. case 'sapi':
  22370. $depChannelName = '';
  22371. $depPackageName = '';
  22372. break;
  22373. default:
  22374. $depChannelName = '';
  22375. $depPackageName = '';
  22376. break;
  22377. }
  22378. if ('' != $depChannelName) {
  22379. $result[] = new DependencyConstraint(
  22380. $depType,
  22381. $depVersionConstraint,
  22382. $depChannelName,
  22383. $depPackageName
  22384. );
  22385. }
  22386. }
  22387. return $result;
  22388. }
  22389. private function buildDependency20Info($depArray)
  22390. {
  22391. $result = array();
  22392. $optionals = array();
  22393. $defaultOptionals = array();
  22394. foreach ($depArray as $depType => $depTypeGroup) {
  22395. if (!is_array($depTypeGroup)) {
  22396. continue;
  22397. }
  22398. if ('required' == $depType || 'optional' == $depType) {
  22399. foreach ($depTypeGroup as $depItemType => $depItem) {
  22400. switch ($depItemType) {
  22401. case 'php':
  22402. $result[] = new DependencyConstraint(
  22403. $depType,
  22404. $this->parse20VersionConstraint($depItem),
  22405. 'php',
  22406. ''
  22407. );
  22408. break;
  22409. case 'package':
  22410. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  22411. $result = array_merge($result, $deps);
  22412. break;
  22413. case 'extension':
  22414. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  22415. $result = array_merge($result, $deps);
  22416. break;
  22417. case 'subpackage':
  22418. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  22419. $defaultOptionals += $deps;
  22420. break;
  22421. case 'os':
  22422. case 'pearinstaller':
  22423. break;
  22424. default:
  22425. break;
  22426. }
  22427. }
  22428. } elseif ('group' == $depType) {
  22429. if ($this->isHash($depTypeGroup)) {
  22430. $depTypeGroup = array($depTypeGroup);
  22431. }
  22432. foreach ($depTypeGroup as $depItem) {
  22433. $groupName = $depItem['attribs']['name'];
  22434. if (!isset($optionals[$groupName])) {
  22435. $optionals[$groupName] = array();
  22436. }
  22437. if (isset($depItem['subpackage'])) {
  22438. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  22439. } else {
  22440. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  22441. }
  22442. }
  22443. }
  22444. }
  22445. if (count($defaultOptionals) > 0) {
  22446. $optionals['*'] = $defaultOptionals;
  22447. }
  22448. return new DependencyInfo($result, $optionals);
  22449. }
  22450. private function buildDepExtensionConstraints($depItem, $depType)
  22451. {
  22452. if ($this->isHash($depItem)) {
  22453. $depItem = array($depItem);
  22454. }
  22455. $result = array();
  22456. foreach ($depItem as $subDepItem) {
  22457. $depChannelName = 'ext';
  22458. $depPackageName = $subDepItem['name'];
  22459. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22460. $result[] = new DependencyConstraint(
  22461. $depType,
  22462. $depVersionConstraint,
  22463. $depChannelName,
  22464. $depPackageName
  22465. );
  22466. }
  22467. return $result;
  22468. }
  22469. private function buildDepPackageConstraints($depItem, $depType)
  22470. {
  22471. if ($this->isHash($depItem)) {
  22472. $depItem = array($depItem);
  22473. }
  22474. $result = array();
  22475. foreach ($depItem as $subDepItem) {
  22476. if (!array_key_exists('channel', $subDepItem)) {
  22477. $subDepItem['channel'] = $subDepItem['uri'];
  22478. }
  22479. $depChannelName = $subDepItem['channel'];
  22480. $depPackageName = $subDepItem['name'];
  22481. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22482. if (isset($subDepItem['conflicts'])) {
  22483. $depType = 'conflicts';
  22484. }
  22485. $result[] = new DependencyConstraint(
  22486. $depType,
  22487. $depVersionConstraint,
  22488. $depChannelName,
  22489. $depPackageName
  22490. );
  22491. }
  22492. return $result;
  22493. }
  22494. private function parse20VersionConstraint(array $data)
  22495. {
  22496. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  22497. $versions = array();
  22498. $values = array_intersect_key($data, $dep20toOperatorMap);
  22499. if (0 == count($values)) {
  22500. return '*';
  22501. }
  22502. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  22503. $versions[] = '>' . $this->parseVersion($values['min']);
  22504. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  22505. $versions[] = '<' . $this->parseVersion($values['max']);
  22506. } else {
  22507. foreach ($values as $op => $version) {
  22508. if ('exclude' == $op && is_array($version)) {
  22509. foreach ($version as $versionPart) {
  22510. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  22511. }
  22512. } else {
  22513. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  22514. }
  22515. }
  22516. }
  22517. return implode(',', $versions);
  22518. }
  22519. private function parseVersion($version)
  22520. {
  22521. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  22522. $version = $matches[1]
  22523. .(!empty($matches[2]) ? $matches[2] : '.0')
  22524. .(!empty($matches[3]) ? $matches[3] : '.0')
  22525. .(!empty($matches[4]) ? $matches[4] : '.0');
  22526. return $version;
  22527. }
  22528. return null;
  22529. }
  22530. private function isHash(array $array)
  22531. {
  22532. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  22533. }
  22534. }
  22535. <?php
  22536. namespace Composer\Repository\Pear;
  22537. class PackageInfo
  22538. {
  22539. private $channelName;
  22540. private $packageName;
  22541. private $license;
  22542. private $shortDescription;
  22543. private $description;
  22544. private $releases;
  22545. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  22546. {
  22547. $this->channelName = $channelName;
  22548. $this->packageName = $packageName;
  22549. $this->license = $license;
  22550. $this->shortDescription = $shortDescription;
  22551. $this->description = $description;
  22552. $this->releases = $releases;
  22553. }
  22554. public function getChannelName()
  22555. {
  22556. return $this->channelName;
  22557. }
  22558. public function getPackageName()
  22559. {
  22560. return $this->packageName;
  22561. }
  22562. public function getDescription()
  22563. {
  22564. return $this->description;
  22565. }
  22566. public function getShortDescription()
  22567. {
  22568. return $this->shortDescription;
  22569. }
  22570. public function getLicense()
  22571. {
  22572. return $this->license;
  22573. }
  22574. public function getReleases()
  22575. {
  22576. return $this->releases;
  22577. }
  22578. }
  22579. <?php
  22580. namespace Composer\Repository\Pear;
  22581. class ReleaseInfo
  22582. {
  22583. private $stability;
  22584. private $dependencyInfo;
  22585. public function __construct($stability, $dependencyInfo)
  22586. {
  22587. $this->stability = $stability;
  22588. $this->dependencyInfo = $dependencyInfo;
  22589. }
  22590. public function getDependencyInfo()
  22591. {
  22592. return $this->dependencyInfo;
  22593. }
  22594. public function getStability()
  22595. {
  22596. return $this->stability;
  22597. }
  22598. }
  22599. <?php
  22600. namespace Composer\Repository;
  22601. use Composer\IO\IOInterface;
  22602. use Composer\Semver\VersionParser as SemverVersionParser;
  22603. use Composer\Package\Version\VersionParser;
  22604. use Composer\Repository\Pear\ChannelReader;
  22605. use Composer\Package\CompletePackage;
  22606. use Composer\Repository\Pear\ChannelInfo;
  22607. use Composer\EventDispatcher\EventDispatcher;
  22608. use Composer\Package\Link;
  22609. use Composer\Semver\Constraint\Constraint;
  22610. use Composer\Util\RemoteFilesystem;
  22611. use Composer\Config;
  22612. use Composer\Factory;
  22613. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22614. {
  22615. private $url;
  22616. private $io;
  22617. private $rfs;
  22618. private $versionParser;
  22619. private $repoConfig;
  22620. private $vendorAlias;
  22621. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  22622. {
  22623. parent::__construct();
  22624. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  22625. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  22626. }
  22627. $urlBits = parse_url($repoConfig['url']);
  22628. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  22629. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  22630. }
  22631. $this->url = rtrim($repoConfig['url'], '/');
  22632. $this->io = $io;
  22633. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  22634. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  22635. $this->versionParser = new VersionParser();
  22636. $this->repoConfig = $repoConfig;
  22637. }
  22638. public function getRepoConfig()
  22639. {
  22640. return $this->repoConfig;
  22641. }
  22642. protected function initialize()
  22643. {
  22644. parent::initialize();
  22645. $this->io->writeError('Initializing PEAR repository '.$this->url);
  22646. $reader = new ChannelReader($this->rfs);
  22647. try {
  22648. $channelInfo = $reader->read($this->url);
  22649. } catch (\Exception $e) {
  22650. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  22651. return;
  22652. }
  22653. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  22654. foreach ($packages as $package) {
  22655. $this->addPackage($package);
  22656. }
  22657. }
  22658. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  22659. {
  22660. $result = array();
  22661. foreach ($channelInfo->getPackages() as $packageDefinition) {
  22662. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  22663. try {
  22664. $normalizedVersion = $versionParser->normalize($version);
  22665. } catch (\UnexpectedValueException $e) {
  22666. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  22667. continue;
  22668. }
  22669. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  22670. $urlBits = parse_url($this->url);
  22671. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  22672. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  22673. $requires = array();
  22674. $suggests = array();
  22675. $conflicts = array();
  22676. $replaces = array();
  22677. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  22678. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  22679. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22680. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22681. }
  22682. if (!empty($this->vendorAlias)
  22683. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  22684. ) {
  22685. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  22686. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22687. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22688. }
  22689. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  22690. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22691. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  22692. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  22693. switch ($dependencyConstraint->getType()) {
  22694. case 'required':
  22695. $requires[] = $link;
  22696. break;
  22697. case 'conflicts':
  22698. $conflicts[] = $link;
  22699. break;
  22700. case 'replaces':
  22701. $replaces[] = $link;
  22702. break;
  22703. }
  22704. }
  22705. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  22706. foreach ($dependencyConstraints as $dependencyConstraint) {
  22707. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22708. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  22709. }
  22710. }
  22711. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  22712. $package->setType('pear-library');
  22713. $package->setDescription($packageDefinition->getDescription());
  22714. $package->setLicense(array($packageDefinition->getLicense()));
  22715. $package->setDistType('file');
  22716. $package->setDistUrl($distUrl);
  22717. $package->setAutoload(array('classmap' => array('')));
  22718. $package->setIncludePaths(array('/'));
  22719. $package->setRequires($requires);
  22720. $package->setConflicts($conflicts);
  22721. $package->setSuggests($suggests);
  22722. $package->setReplaces($replaces);
  22723. $result[] = $package;
  22724. }
  22725. }
  22726. return $result;
  22727. }
  22728. private function buildComposerPackageName($channelName, $packageName)
  22729. {
  22730. if ('php' === $channelName) {
  22731. return "php";
  22732. }
  22733. if ('ext' === $channelName) {
  22734. return "ext-{$packageName}";
  22735. }
  22736. return "pear-{$channelName}/{$packageName}";
  22737. }
  22738. }
  22739. <?php
  22740. namespace Composer\Repository;
  22741. use Composer\Composer;
  22742. use Composer\Package\CompletePackage;
  22743. use Composer\Package\PackageInterface;
  22744. use Composer\Package\Version\VersionParser;
  22745. use Composer\Plugin\PluginInterface;
  22746. use Composer\Util\ProcessExecutor;
  22747. use Composer\Util\Silencer;
  22748. use Composer\Util\Platform;
  22749. use Composer\XdebugHandler\XdebugHandler;
  22750. use Symfony\Component\Process\ExecutableFinder;
  22751. class PlatformRepository extends ArrayRepository
  22752. {
  22753. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD';
  22754. private $versionParser;
  22755. private $overrides = array();
  22756. private $process;
  22757. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  22758. {
  22759. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  22760. foreach ($overrides as $name => $version) {
  22761. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  22762. }
  22763. parent::__construct($packages);
  22764. }
  22765. protected function initialize()
  22766. {
  22767. parent::initialize();
  22768. $this->versionParser = new VersionParser();
  22769. foreach ($this->overrides as $override) {
  22770. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  22771. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  22772. }
  22773. $this->addOverriddenPackage($override);
  22774. }
  22775. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  22776. $version = $this->versionParser->normalize($prettyVersion);
  22777. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  22778. $composerPluginApi->setDescription('The Composer Plugin API');
  22779. $this->addPackage($composerPluginApi);
  22780. $prettyVersion = Composer::RUNTIME_API_VERSION;
  22781. $version = $this->versionParser->normalize($prettyVersion);
  22782. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  22783. $composerRuntimeApi->setDescription('The Composer Runtime API');
  22784. $this->addPackage($composerRuntimeApi);
  22785. try {
  22786. $prettyVersion = PHP_VERSION;
  22787. $version = $this->versionParser->normalize($prettyVersion);
  22788. } catch (\UnexpectedValueException $e) {
  22789. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  22790. $version = $this->versionParser->normalize($prettyVersion);
  22791. }
  22792. $php = new CompletePackage('php', $version, $prettyVersion);
  22793. $php->setDescription('The PHP interpreter');
  22794. $this->addPackage($php);
  22795. if (PHP_DEBUG) {
  22796. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  22797. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  22798. $this->addPackage($phpdebug);
  22799. }
  22800. if (defined('PHP_ZTS') && PHP_ZTS) {
  22801. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22802. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22803. $this->addPackage($phpzts);
  22804. }
  22805. if (PHP_INT_SIZE === 8) {
  22806. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22807. $php64->setDescription('The PHP interpreter, 64bit');
  22808. $this->addPackage($php64);
  22809. }
  22810. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22811. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22812. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22813. $this->addPackage($phpIpv6);
  22814. }
  22815. $loadedExtensions = get_loaded_extensions();
  22816. foreach ($loadedExtensions as $name) {
  22817. if (in_array($name, array('standard', 'Core'))) {
  22818. continue;
  22819. }
  22820. $reflExt = new \ReflectionExtension($name);
  22821. $prettyVersion = $reflExt->getVersion();
  22822. $this->addExtension($name, $prettyVersion);
  22823. }
  22824. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22825. $this->addExtension('xdebug', $prettyVersion);
  22826. }
  22827. foreach ($loadedExtensions as $name) {
  22828. $prettyVersion = null;
  22829. $description = 'The '.$name.' PHP library';
  22830. switch ($name) {
  22831. case 'curl':
  22832. $curlVersion = curl_version();
  22833. $prettyVersion = $curlVersion['version'];
  22834. break;
  22835. case 'iconv':
  22836. $prettyVersion = ICONV_VERSION;
  22837. break;
  22838. case 'intl':
  22839. $name = 'ICU';
  22840. if (defined('INTL_ICU_VERSION')) {
  22841. $prettyVersion = INTL_ICU_VERSION;
  22842. } else {
  22843. $reflector = new \ReflectionExtension('intl');
  22844. ob_start();
  22845. $reflector->info();
  22846. $output = ob_get_clean();
  22847. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22848. $prettyVersion = $matches[1];
  22849. }
  22850. break;
  22851. case 'imagick':
  22852. $imagick = new \Imagick();
  22853. $imageMagickVersion = $imagick->getVersion();
  22854. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22855. if (isset($matches[2])) {
  22856. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22857. } else {
  22858. $prettyVersion = $matches[1];
  22859. }
  22860. break;
  22861. case 'libxml':
  22862. $prettyVersion = LIBXML_DOTTED_VERSION;
  22863. break;
  22864. case 'openssl':
  22865. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22866. if (empty($match[2])) {
  22867. return $match[1];
  22868. }
  22869. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22870. return 0;
  22871. }
  22872. $len = strlen($match[2]);
  22873. $patchVersion = ($len - 1) * 26;
  22874. $patchVersion += ord($match[2][$len - 1]) - 96;
  22875. return $match[1].'.'.$patchVersion;
  22876. }, OPENSSL_VERSION_TEXT);
  22877. $description = OPENSSL_VERSION_TEXT;
  22878. break;
  22879. case 'pcre':
  22880. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22881. break;
  22882. case 'uuid':
  22883. $prettyVersion = phpversion('uuid');
  22884. break;
  22885. case 'xsl':
  22886. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22887. break;
  22888. default:
  22889. continue 2;
  22890. }
  22891. try {
  22892. $version = $this->versionParser->normalize($prettyVersion);
  22893. } catch (\UnexpectedValueException $e) {
  22894. continue;
  22895. }
  22896. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22897. $lib->setDescription($description);
  22898. $this->addPackage($lib);
  22899. }
  22900. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22901. if ($hhvmVersion === null && !Platform::isWindows()) {
  22902. $finder = new ExecutableFinder();
  22903. $hhvm = $finder->find('hhvm');
  22904. if ($hhvm !== null) {
  22905. $exitCode = $this->process->execute(
  22906. ProcessExecutor::escape($hhvm).
  22907. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22908. $hhvmVersion
  22909. );
  22910. if ($exitCode !== 0) {
  22911. $hhvmVersion = null;
  22912. }
  22913. }
  22914. }
  22915. if ($hhvmVersion) {
  22916. try {
  22917. $prettyVersion = $hhvmVersion;
  22918. $version = $this->versionParser->normalize($prettyVersion);
  22919. } catch (\UnexpectedValueException $e) {
  22920. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22921. $version = $this->versionParser->normalize($prettyVersion);
  22922. }
  22923. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22924. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22925. $this->addPackage($hhvm);
  22926. }
  22927. }
  22928. public function addPackage(PackageInterface $package)
  22929. {
  22930. if (isset($this->overrides[$package->getName()])) {
  22931. $overrider = $this->findPackage($package->getName(), '*');
  22932. if ($package->getVersion() === $overrider->getVersion()) {
  22933. $actualText = 'same as actual';
  22934. } else {
  22935. $actualText = 'actual: '.$package->getPrettyVersion();
  22936. }
  22937. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22938. return;
  22939. }
  22940. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22941. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22942. if ($package->getVersion() === $overrider->getVersion()) {
  22943. $actualText = 'same as actual';
  22944. } else {
  22945. $actualText = 'actual: '.$package->getPrettyVersion();
  22946. }
  22947. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22948. return;
  22949. }
  22950. parent::addPackage($package);
  22951. }
  22952. private function addOverriddenPackage(array $override, $name = null)
  22953. {
  22954. $version = $this->versionParser->normalize($override['version']);
  22955. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22956. $package->setDescription('Package overridden via config.platform');
  22957. $package->setExtra(array('config.platform' => true));
  22958. parent::addPackage($package);
  22959. return $package;
  22960. }
  22961. private function addExtension($name, $prettyVersion)
  22962. {
  22963. $extraDescription = null;
  22964. try {
  22965. $version = $this->versionParser->normalize($prettyVersion);
  22966. } catch (\UnexpectedValueException $e) {
  22967. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22968. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22969. $prettyVersion = $match[1];
  22970. } else {
  22971. $prettyVersion = '0';
  22972. }
  22973. $version = $this->versionParser->normalize($prettyVersion);
  22974. }
  22975. $packageName = $this->buildPackageName($name);
  22976. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22977. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22978. $this->addPackage($ext);
  22979. }
  22980. private function buildPackageName($name)
  22981. {
  22982. return 'ext-' . str_replace(' ', '-', $name);
  22983. }
  22984. }
  22985. <?php
  22986. namespace Composer\Repository;
  22987. use Composer\Factory;
  22988. use Composer\IO\IOInterface;
  22989. use Composer\Config;
  22990. use Composer\EventDispatcher\EventDispatcher;
  22991. use Composer\Util\RemoteFilesystem;
  22992. use Composer\Json\JsonFile;
  22993. class RepositoryFactory
  22994. {
  22995. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22996. {
  22997. if (0 === strpos($repository, 'http')) {
  22998. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22999. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  23000. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  23001. $data = $json->read();
  23002. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  23003. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  23004. } elseif ($allowFilesystem) {
  23005. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  23006. } else {
  23007. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  23008. }
  23009. } elseif ('{' === substr($repository, 0, 1)) {
  23010. $repoConfig = JsonFile::parseJson($repository);
  23011. } else {
  23012. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  23013. }
  23014. return $repoConfig;
  23015. }
  23016. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null)
  23017. {
  23018. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  23019. return static::createRepo($io, $config, $repoConfig, $rm);
  23020. }
  23021. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null)
  23022. {
  23023. if (!$rm) {
  23024. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23025. }
  23026. $repos = static::createRepos($rm, array($repoConfig));
  23027. return reset($repos);
  23028. }
  23029. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  23030. {
  23031. if (!$config) {
  23032. $config = Factory::createConfig($io);
  23033. }
  23034. if ($io) {
  23035. $io->loadConfiguration($config);
  23036. }
  23037. if (!$rm) {
  23038. if (!$io) {
  23039. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  23040. }
  23041. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23042. }
  23043. return static::createRepos($rm, $config->getRepositories());
  23044. }
  23045. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23046. {
  23047. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  23048. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  23049. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  23050. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  23051. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  23052. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  23053. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  23054. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  23055. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  23056. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  23057. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  23058. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  23059. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  23060. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  23061. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  23062. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  23063. return $rm;
  23064. }
  23065. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  23066. {
  23067. $repos = array();
  23068. foreach ($repoConfigs as $index => $repo) {
  23069. if (is_string($repo)) {
  23070. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  23071. }
  23072. if (!is_array($repo)) {
  23073. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  23074. }
  23075. if (!isset($repo['type'])) {
  23076. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  23077. }
  23078. $name = self::generateRepositoryName($index, $repo, $repos);
  23079. if ($repo['type'] === 'filesystem') {
  23080. $repos[$name] = new FilesystemRepository($repo['json']);
  23081. } else {
  23082. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  23083. }
  23084. }
  23085. return $repos;
  23086. }
  23087. public static function generateRepositoryName($index, array $repo, array $existingRepos)
  23088. {
  23089. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  23090. while (isset($existingRepos[$name])) {
  23091. $name .= '2';
  23092. }
  23093. return $name;
  23094. }
  23095. }
  23096. <?php
  23097. namespace Composer\Repository;
  23098. use Composer\Package\PackageInterface;
  23099. interface RepositoryInterface extends \Countable
  23100. {
  23101. const SEARCH_FULLTEXT = 0;
  23102. const SEARCH_NAME = 1;
  23103. public function hasPackage(PackageInterface $package);
  23104. public function findPackage($name, $constraint);
  23105. public function findPackages($name, $constraint = null);
  23106. public function getPackages();
  23107. public function search($query, $mode = 0);
  23108. }
  23109. <?php
  23110. namespace Composer\Repository;
  23111. use Composer\IO\IOInterface;
  23112. use Composer\Config;
  23113. use Composer\EventDispatcher\EventDispatcher;
  23114. use Composer\Package\PackageInterface;
  23115. use Composer\Util\RemoteFilesystem;
  23116. class RepositoryManager
  23117. {
  23118. private $localRepository;
  23119. private $repositories = array();
  23120. private $repositoryClasses = array();
  23121. private $io;
  23122. private $config;
  23123. private $eventDispatcher;
  23124. private $rfs;
  23125. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23126. {
  23127. $this->io = $io;
  23128. $this->config = $config;
  23129. $this->eventDispatcher = $eventDispatcher;
  23130. $this->rfs = $rfs;
  23131. }
  23132. public function findPackage($name, $constraint)
  23133. {
  23134. foreach ($this->repositories as $repository) {
  23135. if ($package = $repository->findPackage($name, $constraint)) {
  23136. return $package;
  23137. }
  23138. }
  23139. return null;
  23140. }
  23141. public function findPackages($name, $constraint)
  23142. {
  23143. $packages = array();
  23144. foreach ($this->getRepositories() as $repository) {
  23145. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  23146. }
  23147. return $packages;
  23148. }
  23149. public function addRepository(RepositoryInterface $repository)
  23150. {
  23151. $this->repositories[] = $repository;
  23152. }
  23153. public function prependRepository(RepositoryInterface $repository)
  23154. {
  23155. array_unshift($this->repositories, $repository);
  23156. }
  23157. public function createRepository($type, $config, $name = null)
  23158. {
  23159. if (!isset($this->repositoryClasses[$type])) {
  23160. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  23161. }
  23162. if (isset($config['packagist']) && false === $config['packagist']) {
  23163. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  23164. }
  23165. $class = $this->repositoryClasses[$type];
  23166. $reflMethod = new \ReflectionMethod($class, '__construct');
  23167. $params = $reflMethod->getParameters();
  23168. if (isset($params[4])) {
  23169. $paramType = null;
  23170. if (\PHP_VERSION_ID >= 70000) {
  23171. $reflectionType = $params[4]->getType();
  23172. if ($reflectionType) {
  23173. $paramType = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  23174. }
  23175. } else {
  23176. $paramType = $params[4]->getClass() ? $params[4]->getClass()->getName() : null;
  23177. }
  23178. if ($paramType === 'Composer\Util\RemoteFilesystem') {
  23179. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  23180. }
  23181. }
  23182. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  23183. }
  23184. public function setRepositoryClass($type, $class)
  23185. {
  23186. $this->repositoryClasses[$type] = $class;
  23187. }
  23188. public function getRepositories()
  23189. {
  23190. return $this->repositories;
  23191. }
  23192. public function setLocalRepository(WritableRepositoryInterface $repository)
  23193. {
  23194. $this->localRepository = $repository;
  23195. }
  23196. public function getLocalRepository()
  23197. {
  23198. return $this->localRepository;
  23199. }
  23200. }
  23201. <?php
  23202. namespace Composer\Repository;
  23203. class RepositorySecurityException extends \Exception
  23204. {
  23205. }
  23206. <?php
  23207. namespace Composer\Repository\Vcs;
  23208. use Composer\Cache;
  23209. use Composer\Downloader\TransportException;
  23210. use Composer\Json\JsonFile;
  23211. use Composer\Util\Bitbucket;
  23212. abstract class BitbucketDriver extends VcsDriver
  23213. {
  23214. protected $cache;
  23215. protected $owner;
  23216. protected $repository;
  23217. protected $hasIssues;
  23218. protected $rootIdentifier;
  23219. protected $tags;
  23220. protected $branches;
  23221. protected $infoCache = array();
  23222. protected $branchesUrl = '';
  23223. protected $tagsUrl = '';
  23224. protected $homeUrl = '';
  23225. protected $website = '';
  23226. protected $cloneHttpsUrl = '';
  23227. protected $fallbackDriver;
  23228. protected $vcsType;
  23229. public function initialize()
  23230. {
  23231. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  23232. $this->owner = $match[1];
  23233. $this->repository = $match[2];
  23234. $this->originUrl = 'bitbucket.org';
  23235. $this->cache = new Cache(
  23236. $this->io,
  23237. implode('/', array(
  23238. $this->config->get('cache-repo-dir'),
  23239. $this->originUrl,
  23240. $this->owner,
  23241. $this->repository,
  23242. ))
  23243. );
  23244. }
  23245. public function getUrl()
  23246. {
  23247. if ($this->fallbackDriver) {
  23248. return $this->fallbackDriver->getUrl();
  23249. }
  23250. return $this->cloneHttpsUrl;
  23251. }
  23252. protected function getRepoData()
  23253. {
  23254. $resource = sprintf(
  23255. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  23256. $this->owner,
  23257. $this->repository,
  23258. http_build_query(
  23259. array('fields' => '-project,-owner'),
  23260. null,
  23261. '&'
  23262. )
  23263. );
  23264. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  23265. if ($this->fallbackDriver) {
  23266. return false;
  23267. }
  23268. $this->parseCloneUrls($repoData['links']['clone']);
  23269. $this->hasIssues = !empty($repoData['has_issues']);
  23270. $this->branchesUrl = $repoData['links']['branches']['href'];
  23271. $this->tagsUrl = $repoData['links']['tags']['href'];
  23272. $this->homeUrl = $repoData['links']['html']['href'];
  23273. $this->website = $repoData['website'];
  23274. $this->vcsType = $repoData['scm'];
  23275. return true;
  23276. }
  23277. public function getComposerInformation($identifier)
  23278. {
  23279. if ($this->fallbackDriver) {
  23280. return $this->fallbackDriver->getComposerInformation($identifier);
  23281. }
  23282. if (!isset($this->infoCache[$identifier])) {
  23283. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23284. $composer = JsonFile::parseJson($res);
  23285. } else {
  23286. $composer = $this->getBaseComposerInformation($identifier);
  23287. if ($this->shouldCache($identifier)) {
  23288. $this->cache->write($identifier, json_encode($composer));
  23289. }
  23290. }
  23291. if ($composer) {
  23292. if (!isset($composer['support']['source'])) {
  23293. $label = array_search(
  23294. $identifier,
  23295. $this->getTags()
  23296. ) ?: array_search(
  23297. $identifier,
  23298. $this->getBranches()
  23299. ) ?: $identifier;
  23300. if (array_key_exists($label, $tags = $this->getTags())) {
  23301. $hash = $tags[$label];
  23302. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  23303. $hash = $branches[$label];
  23304. }
  23305. if (! isset($hash)) {
  23306. $composer['support']['source'] = sprintf(
  23307. 'https://%s/%s/%s/src',
  23308. $this->originUrl,
  23309. $this->owner,
  23310. $this->repository
  23311. );
  23312. } else {
  23313. $composer['support']['source'] = sprintf(
  23314. 'https://%s/%s/%s/src/%s/?at=%s',
  23315. $this->originUrl,
  23316. $this->owner,
  23317. $this->repository,
  23318. $hash,
  23319. $label
  23320. );
  23321. }
  23322. }
  23323. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23324. $composer['support']['issues'] = sprintf(
  23325. 'https://%s/%s/%s/issues',
  23326. $this->originUrl,
  23327. $this->owner,
  23328. $this->repository
  23329. );
  23330. }
  23331. if (!isset($composer['homepage'])) {
  23332. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  23333. }
  23334. }
  23335. $this->infoCache[$identifier] = $composer;
  23336. }
  23337. return $this->infoCache[$identifier];
  23338. }
  23339. public function getFileContent($file, $identifier)
  23340. {
  23341. if ($this->fallbackDriver) {
  23342. return $this->fallbackDriver->getFileContent($file, $identifier);
  23343. }
  23344. if (strpos($identifier, '/') !== false) {
  23345. $branches = $this->getBranches();
  23346. if (isset($branches[$identifier])) {
  23347. $identifier = $branches[$identifier];
  23348. }
  23349. }
  23350. $resource = sprintf(
  23351. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  23352. $this->owner,
  23353. $this->repository,
  23354. $identifier,
  23355. $file
  23356. );
  23357. return $this->getContentsWithOAuthCredentials($resource);
  23358. }
  23359. public function getChangeDate($identifier)
  23360. {
  23361. if ($this->fallbackDriver) {
  23362. return $this->fallbackDriver->getChangeDate($identifier);
  23363. }
  23364. if (strpos($identifier, '/') !== false) {
  23365. $branches = $this->getBranches();
  23366. if (isset($branches[$identifier])) {
  23367. $identifier = $branches[$identifier];
  23368. }
  23369. }
  23370. $resource = sprintf(
  23371. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  23372. $this->owner,
  23373. $this->repository,
  23374. $identifier
  23375. );
  23376. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23377. return new \DateTime($commit['date']);
  23378. }
  23379. public function getSource($identifier)
  23380. {
  23381. if ($this->fallbackDriver) {
  23382. return $this->fallbackDriver->getSource($identifier);
  23383. }
  23384. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  23385. }
  23386. public function getDist($identifier)
  23387. {
  23388. if ($this->fallbackDriver) {
  23389. return $this->fallbackDriver->getDist($identifier);
  23390. }
  23391. $url = sprintf(
  23392. 'https://bitbucket.org/%s/%s/get/%s.zip',
  23393. $this->owner,
  23394. $this->repository,
  23395. $identifier
  23396. );
  23397. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23398. }
  23399. public function getTags()
  23400. {
  23401. if ($this->fallbackDriver) {
  23402. return $this->fallbackDriver->getTags();
  23403. }
  23404. if (null === $this->tags) {
  23405. $this->tags = array();
  23406. $resource = sprintf(
  23407. '%s?%s',
  23408. $this->tagsUrl,
  23409. http_build_query(
  23410. array(
  23411. 'pagelen' => 100,
  23412. 'fields' => 'values.name,values.target.hash,next',
  23413. 'sort' => '-target.date',
  23414. ),
  23415. null,
  23416. '&'
  23417. )
  23418. );
  23419. $hasNext = true;
  23420. while ($hasNext) {
  23421. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23422. foreach ($tagsData['values'] as $data) {
  23423. $this->tags[$data['name']] = $data['target']['hash'];
  23424. }
  23425. if (empty($tagsData['next'])) {
  23426. $hasNext = false;
  23427. } else {
  23428. $resource = $tagsData['next'];
  23429. }
  23430. }
  23431. if ($this->vcsType === 'hg') {
  23432. unset($this->tags['tip']);
  23433. }
  23434. }
  23435. return $this->tags;
  23436. }
  23437. public function getBranches()
  23438. {
  23439. if ($this->fallbackDriver) {
  23440. return $this->fallbackDriver->getBranches();
  23441. }
  23442. if (null === $this->branches) {
  23443. $this->branches = array();
  23444. $resource = sprintf(
  23445. '%s?%s',
  23446. $this->branchesUrl,
  23447. http_build_query(
  23448. array(
  23449. 'pagelen' => 100,
  23450. 'fields' => 'values.name,values.target.hash,values.heads,next',
  23451. 'sort' => '-target.date',
  23452. ),
  23453. null,
  23454. '&'
  23455. )
  23456. );
  23457. $hasNext = true;
  23458. while ($hasNext) {
  23459. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23460. foreach ($branchData['values'] as $data) {
  23461. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  23462. continue;
  23463. }
  23464. $this->branches[$data['name']] = $data['target']['hash'];
  23465. }
  23466. if (empty($branchData['next'])) {
  23467. $hasNext = false;
  23468. } else {
  23469. $resource = $branchData['next'];
  23470. }
  23471. }
  23472. }
  23473. return $this->branches;
  23474. }
  23475. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  23476. {
  23477. try {
  23478. return parent::getContents($url);
  23479. } catch (TransportException $e) {
  23480. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23481. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  23482. if (!$this->io->hasAuthentication($this->originUrl)
  23483. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  23484. ) {
  23485. return parent::getContents($url);
  23486. }
  23487. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23488. return $this->attemptCloneFallback();
  23489. }
  23490. }
  23491. throw $e;
  23492. }
  23493. }
  23494. abstract protected function generateSshUrl();
  23495. protected function attemptCloneFallback()
  23496. {
  23497. try {
  23498. $this->setupFallbackDriver($this->generateSshUrl());
  23499. } catch (\RuntimeException $e) {
  23500. $this->fallbackDriver = null;
  23501. $this->io->writeError(
  23502. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  23503. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  23504. );
  23505. throw $e;
  23506. }
  23507. }
  23508. abstract protected function setupFallbackDriver($url);
  23509. protected function parseCloneUrls(array $cloneLinks)
  23510. {
  23511. foreach ($cloneLinks as $cloneLink) {
  23512. if ($cloneLink['name'] === 'https') {
  23513. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  23514. }
  23515. }
  23516. }
  23517. protected function getMainBranchData()
  23518. {
  23519. $resource = sprintf(
  23520. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  23521. $this->owner,
  23522. $this->repository
  23523. );
  23524. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23525. if (isset($data['mainbranch'])) {
  23526. return $data['mainbranch'];
  23527. }
  23528. return null;
  23529. }
  23530. }
  23531. <?php
  23532. namespace Composer\Repository\Vcs;
  23533. use Composer\Cache;
  23534. use Composer\Config;
  23535. use Composer\Util\ProcessExecutor;
  23536. use Composer\Util\Filesystem;
  23537. use Composer\IO\IOInterface;
  23538. class FossilDriver extends VcsDriver
  23539. {
  23540. protected $tags;
  23541. protected $branches;
  23542. protected $rootIdentifier;
  23543. protected $repoFile;
  23544. protected $checkoutDir;
  23545. protected $infoCache = array();
  23546. public function initialize()
  23547. {
  23548. $this->checkFossil();
  23549. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23550. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  23551. $this->checkoutDir = $this->url;
  23552. } else {
  23553. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23554. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23555. }
  23556. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  23557. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  23558. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  23559. $this->updateLocalRepo();
  23560. }
  23561. $this->getTags();
  23562. $this->getBranches();
  23563. }
  23564. protected function checkFossil()
  23565. {
  23566. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  23567. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  23568. }
  23569. }
  23570. protected function updateLocalRepo()
  23571. {
  23572. $fs = new Filesystem();
  23573. $fs->ensureDirectoryExists($this->checkoutDir);
  23574. if (!is_writable(dirname($this->checkoutDir))) {
  23575. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  23576. }
  23577. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  23578. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  23579. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23580. }
  23581. } else {
  23582. $fs->removeDirectory($this->checkoutDir);
  23583. $fs->remove($this->repoFile);
  23584. $fs->ensureDirectoryExists($this->checkoutDir);
  23585. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  23586. $output = $this->process->getErrorOutput();
  23587. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  23588. }
  23589. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  23590. $output = $this->process->getErrorOutput();
  23591. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  23592. }
  23593. }
  23594. }
  23595. public function getRootIdentifier()
  23596. {
  23597. if (null === $this->rootIdentifier) {
  23598. $this->rootIdentifier = 'trunk';
  23599. }
  23600. return $this->rootIdentifier;
  23601. }
  23602. public function getUrl()
  23603. {
  23604. return $this->url;
  23605. }
  23606. public function getSource($identifier)
  23607. {
  23608. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  23609. }
  23610. public function getDist($identifier)
  23611. {
  23612. return null;
  23613. }
  23614. public function getFileContent($file, $identifier)
  23615. {
  23616. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23617. $this->process->execute($command, $content, $this->checkoutDir);
  23618. if (!trim($content)) {
  23619. return null;
  23620. }
  23621. return $content;
  23622. }
  23623. public function getChangeDate($identifier)
  23624. {
  23625. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  23626. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  23627. return new \DateTime($date, new \DateTimeZone('UTC'));
  23628. }
  23629. public function getTags()
  23630. {
  23631. if (null === $this->tags) {
  23632. $tags = array();
  23633. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  23634. foreach ($this->process->splitLines($output) as $tag) {
  23635. $tags[$tag] = $tag;
  23636. }
  23637. $this->tags = $tags;
  23638. }
  23639. return $this->tags;
  23640. }
  23641. public function getBranches()
  23642. {
  23643. if (null === $this->branches) {
  23644. $branches = array();
  23645. $bookmarks = array();
  23646. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  23647. foreach ($this->process->splitLines($output) as $branch) {
  23648. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  23649. $branches[$branch] = $branch;
  23650. }
  23651. $this->branches = $branches;
  23652. }
  23653. return $this->branches;
  23654. }
  23655. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23656. {
  23657. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  23658. return true;
  23659. }
  23660. if (preg_match('!/fossil/|\.fossil!', $url)) {
  23661. return true;
  23662. }
  23663. if (Filesystem::isLocalPath($url)) {
  23664. $url = Filesystem::getPlatformPath($url);
  23665. if (!is_dir($url)) {
  23666. return false;
  23667. }
  23668. $process = new ProcessExecutor($io);
  23669. if ($process->execute('fossil info', $output, $url) === 0) {
  23670. return true;
  23671. }
  23672. }
  23673. return false;
  23674. }
  23675. }
  23676. <?php
  23677. namespace Composer\Repository\Vcs;
  23678. use Composer\Config;
  23679. use Composer\IO\IOInterface;
  23680. class GitBitbucketDriver extends BitbucketDriver
  23681. {
  23682. public function getRootIdentifier()
  23683. {
  23684. if ($this->fallbackDriver) {
  23685. return $this->fallbackDriver->getRootIdentifier();
  23686. }
  23687. if (null === $this->rootIdentifier) {
  23688. if (! $this->getRepoData()) {
  23689. return $this->fallbackDriver->getRootIdentifier();
  23690. }
  23691. if ($this->vcsType !== 'git') {
  23692. throw new \RuntimeException(
  23693. $this->url.' does not appear to be a git repository, use '.
  23694. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  23695. );
  23696. }
  23697. $mainBranchData = $this->getMainBranchData();
  23698. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  23699. }
  23700. return $this->rootIdentifier;
  23701. }
  23702. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23703. {
  23704. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  23705. return false;
  23706. }
  23707. if (!extension_loaded('openssl')) {
  23708. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23709. return false;
  23710. }
  23711. return true;
  23712. }
  23713. protected function setupFallbackDriver($url)
  23714. {
  23715. $this->fallbackDriver = new GitDriver(
  23716. array('url' => $url),
  23717. $this->io,
  23718. $this->config,
  23719. $this->process,
  23720. $this->remoteFilesystem
  23721. );
  23722. $this->fallbackDriver->initialize();
  23723. }
  23724. protected function generateSshUrl()
  23725. {
  23726. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  23727. }
  23728. }
  23729. <?php
  23730. namespace Composer\Repository\Vcs;
  23731. use Composer\Util\ProcessExecutor;
  23732. use Composer\Util\Filesystem;
  23733. use Composer\Util\Git as GitUtil;
  23734. use Composer\IO\IOInterface;
  23735. use Composer\Cache;
  23736. use Composer\Config;
  23737. class GitDriver extends VcsDriver
  23738. {
  23739. protected $cache;
  23740. protected $tags;
  23741. protected $branches;
  23742. protected $rootIdentifier;
  23743. protected $repoDir;
  23744. protected $infoCache = array();
  23745. public function initialize()
  23746. {
  23747. if (Filesystem::isLocalPath($this->url)) {
  23748. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  23749. $this->repoDir = $this->url;
  23750. $cacheUrl = realpath($this->url);
  23751. } else {
  23752. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23753. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23754. }
  23755. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  23756. GitUtil::cleanEnv();
  23757. $fs = new Filesystem();
  23758. $fs->ensureDirectoryExists(dirname($this->repoDir));
  23759. if (!is_writable(dirname($this->repoDir))) {
  23760. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  23761. }
  23762. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  23763. 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.');
  23764. }
  23765. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  23766. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  23767. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  23768. }
  23769. $cacheUrl = $this->url;
  23770. }
  23771. $this->getTags();
  23772. $this->getBranches();
  23773. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  23774. }
  23775. public function getRootIdentifier()
  23776. {
  23777. if (null === $this->rootIdentifier) {
  23778. $this->rootIdentifier = 'master';
  23779. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  23780. $branches = $this->process->splitLines($output);
  23781. if (!in_array('* master', $branches)) {
  23782. foreach ($branches as $branch) {
  23783. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  23784. $this->rootIdentifier = $match[1];
  23785. break;
  23786. }
  23787. }
  23788. }
  23789. }
  23790. return $this->rootIdentifier;
  23791. }
  23792. public function getUrl()
  23793. {
  23794. return $this->url;
  23795. }
  23796. public function getSource($identifier)
  23797. {
  23798. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  23799. }
  23800. public function getDist($identifier)
  23801. {
  23802. return null;
  23803. }
  23804. public function getFileContent($file, $identifier)
  23805. {
  23806. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23807. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  23808. if (!trim($content)) {
  23809. return null;
  23810. }
  23811. return $content;
  23812. }
  23813. public function getChangeDate($identifier)
  23814. {
  23815. $this->process->execute(sprintf(
  23816. 'git -c log.showSignature=false log -1 --format=%%at %s',
  23817. ProcessExecutor::escape($identifier)
  23818. ), $output, $this->repoDir);
  23819. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23820. }
  23821. public function getTags()
  23822. {
  23823. if (null === $this->tags) {
  23824. $this->tags = array();
  23825. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23826. foreach ($output = $this->process->splitLines($output) as $tag) {
  23827. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23828. $this->tags[$match[2]] = $match[1];
  23829. }
  23830. }
  23831. }
  23832. return $this->tags;
  23833. }
  23834. public function getBranches()
  23835. {
  23836. if (null === $this->branches) {
  23837. $branches = array();
  23838. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23839. foreach ($this->process->splitLines($output) as $branch) {
  23840. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23841. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23842. $branches[$match[1]] = $match[2];
  23843. }
  23844. }
  23845. }
  23846. $this->branches = $branches;
  23847. }
  23848. return $this->branches;
  23849. }
  23850. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23851. {
  23852. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23853. return true;
  23854. }
  23855. if (Filesystem::isLocalPath($url)) {
  23856. $url = Filesystem::getPlatformPath($url);
  23857. if (!is_dir($url)) {
  23858. return false;
  23859. }
  23860. $process = new ProcessExecutor($io);
  23861. if ($process->execute('git tag', $output, $url) === 0) {
  23862. return true;
  23863. }
  23864. }
  23865. if (!$deep) {
  23866. return false;
  23867. }
  23868. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  23869. GitUtil::cleanEnv();
  23870. try {
  23871. $gitUtil->runCommand(function ($url) {
  23872. return 'git ls-remote --heads ' . ProcessExecutor::escape($url);
  23873. }, $url, sys_get_temp_dir());
  23874. } catch (\RuntimeException $e) {
  23875. return false;
  23876. }
  23877. return true;
  23878. }
  23879. }
  23880. <?php
  23881. namespace Composer\Repository\Vcs;
  23882. use Composer\Config;
  23883. use Composer\Downloader\TransportException;
  23884. use Composer\Json\JsonFile;
  23885. use Composer\Cache;
  23886. use Composer\IO\IOInterface;
  23887. use Composer\Util\GitHub;
  23888. class GitHubDriver extends VcsDriver
  23889. {
  23890. protected $cache;
  23891. protected $owner;
  23892. protected $repository;
  23893. protected $tags;
  23894. protected $branches;
  23895. protected $rootIdentifier;
  23896. protected $repoData;
  23897. protected $hasIssues;
  23898. protected $infoCache = array();
  23899. protected $isPrivate = false;
  23900. private $isArchived = false;
  23901. private $fundingInfo;
  23902. protected $gitDriver;
  23903. public function initialize()
  23904. {
  23905. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23906. $this->owner = $match[3];
  23907. $this->repository = $match[4];
  23908. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23909. if ($this->originUrl === 'www.github.com') {
  23910. $this->originUrl = 'github.com';
  23911. }
  23912. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23913. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23914. $this->setupGitDriver($this->url);
  23915. return;
  23916. }
  23917. $this->fetchRootIdentifier();
  23918. }
  23919. public function getRepositoryUrl()
  23920. {
  23921. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23922. }
  23923. public function getRootIdentifier()
  23924. {
  23925. if ($this->gitDriver) {
  23926. return $this->gitDriver->getRootIdentifier();
  23927. }
  23928. return $this->rootIdentifier;
  23929. }
  23930. public function getUrl()
  23931. {
  23932. if ($this->gitDriver) {
  23933. return $this->gitDriver->getUrl();
  23934. }
  23935. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23936. }
  23937. protected function getApiUrl()
  23938. {
  23939. if ('github.com' === $this->originUrl) {
  23940. $apiUrl = 'api.github.com';
  23941. } else {
  23942. $apiUrl = $this->originUrl . '/api/v3';
  23943. }
  23944. return 'https://' . $apiUrl;
  23945. }
  23946. public function getSource($identifier)
  23947. {
  23948. if ($this->gitDriver) {
  23949. return $this->gitDriver->getSource($identifier);
  23950. }
  23951. if ($this->isPrivate) {
  23952. $url = $this->generateSshUrl();
  23953. } else {
  23954. $url = $this->getUrl();
  23955. }
  23956. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23957. }
  23958. public function getDist($identifier)
  23959. {
  23960. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23961. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23962. }
  23963. public function getComposerInformation($identifier)
  23964. {
  23965. if ($this->gitDriver) {
  23966. return $this->gitDriver->getComposerInformation($identifier);
  23967. }
  23968. if (!isset($this->infoCache[$identifier])) {
  23969. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23970. $composer = JsonFile::parseJson($res);
  23971. } else {
  23972. $composer = $this->getBaseComposerInformation($identifier);
  23973. if ($this->shouldCache($identifier)) {
  23974. $this->cache->write($identifier, json_encode($composer));
  23975. }
  23976. }
  23977. if ($composer) {
  23978. if (!isset($composer['support']['source'])) {
  23979. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23980. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23981. }
  23982. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23983. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23984. }
  23985. if (!isset($composer['abandoned']) && $this->isArchived) {
  23986. $composer['abandoned'] = true;
  23987. }
  23988. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  23989. $composer['funding'] = $funding;
  23990. }
  23991. }
  23992. $this->infoCache[$identifier] = $composer;
  23993. }
  23994. return $this->infoCache[$identifier];
  23995. }
  23996. private function getFundingInfo()
  23997. {
  23998. if (null !== $this->fundingInfo) {
  23999. return $this->fundingInfo;
  24000. }
  24001. if ($this->originUrl !== 'github.com') {
  24002. return $this->fundingInfo = false;
  24003. }
  24004. foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
  24005. try {
  24006. $result = $this->remoteFilesystem->getContents($this->originUrl, $file, false, array(
  24007. 'retry-auth-failure' => false,
  24008. ));
  24009. $response = json_decode($result, true);
  24010. } catch (TransportException $e) {
  24011. continue;
  24012. }
  24013. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  24014. continue;
  24015. }
  24016. break;
  24017. }
  24018. if (empty($funding)) {
  24019. return $this->fundingInfo = false;
  24020. }
  24021. $result = array();
  24022. $key = null;
  24023. foreach (preg_split('{\r?\n}', $funding) as $line) {
  24024. $line = trim($line);
  24025. if (preg_match('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  24026. if (preg_match('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  24027. foreach (array_map('trim', preg_split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  24028. $result[] = array('type' => $match[1], 'url' => trim($item, '"\' '));
  24029. }
  24030. } elseif (preg_match('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
  24031. $result[] = array('type' => $match[1], 'url' => trim($match2[1], '"\' '));
  24032. }
  24033. $key = null;
  24034. } elseif (preg_match('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  24035. $key = $match[1];
  24036. } elseif ($key && preg_match('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) {
  24037. $result[] = array('type' => $key, 'url' => trim($match[1], '"\' '));
  24038. }
  24039. }
  24040. foreach ($result as $key => $item) {
  24041. switch ($item['type']) {
  24042. case 'tidelift':
  24043. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  24044. break;
  24045. case 'github':
  24046. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  24047. break;
  24048. case 'patreon':
  24049. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  24050. break;
  24051. case 'otechie':
  24052. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  24053. break;
  24054. case 'open_collective':
  24055. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  24056. break;
  24057. case 'liberapay':
  24058. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  24059. break;
  24060. case 'ko_fi':
  24061. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  24062. break;
  24063. case 'issuehunt':
  24064. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  24065. break;
  24066. case 'community_bridge':
  24067. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  24068. break;
  24069. }
  24070. }
  24071. return $this->fundingInfo = $result;
  24072. }
  24073. public function getFileContent($file, $identifier)
  24074. {
  24075. if ($this->gitDriver) {
  24076. return $this->gitDriver->getFileContent($file, $identifier);
  24077. }
  24078. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  24079. $resource = JsonFile::parseJson($this->getContents($resource));
  24080. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  24081. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  24082. }
  24083. return $content;
  24084. }
  24085. public function getChangeDate($identifier)
  24086. {
  24087. if ($this->gitDriver) {
  24088. return $this->gitDriver->getChangeDate($identifier);
  24089. }
  24090. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  24091. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  24092. return new \DateTime($commit['commit']['committer']['date']);
  24093. }
  24094. public function getTags()
  24095. {
  24096. if ($this->gitDriver) {
  24097. return $this->gitDriver->getTags();
  24098. }
  24099. if (null === $this->tags) {
  24100. $this->tags = array();
  24101. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  24102. do {
  24103. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  24104. foreach ($tagsData as $tag) {
  24105. $this->tags[$tag['name']] = $tag['commit']['sha'];
  24106. }
  24107. $resource = $this->getNextPage();
  24108. } while ($resource);
  24109. }
  24110. return $this->tags;
  24111. }
  24112. public function getBranches()
  24113. {
  24114. if ($this->gitDriver) {
  24115. return $this->gitDriver->getBranches();
  24116. }
  24117. if (null === $this->branches) {
  24118. $this->branches = array();
  24119. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  24120. do {
  24121. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  24122. foreach ($branchData as $branch) {
  24123. $name = substr($branch['ref'], 11);
  24124. if ($name !== 'gh-pages') {
  24125. $this->branches[$name] = $branch['object']['sha'];
  24126. }
  24127. }
  24128. $resource = $this->getNextPage();
  24129. } while ($resource);
  24130. }
  24131. return $this->branches;
  24132. }
  24133. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24134. {
  24135. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  24136. return false;
  24137. }
  24138. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  24139. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  24140. return false;
  24141. }
  24142. if (!extension_loaded('openssl')) {
  24143. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24144. return false;
  24145. }
  24146. return true;
  24147. }
  24148. public function getRepoData()
  24149. {
  24150. $this->fetchRootIdentifier();
  24151. return $this->repoData;
  24152. }
  24153. protected function generateSshUrl()
  24154. {
  24155. if (false !== strpos($this->originUrl, ':')) {
  24156. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  24157. }
  24158. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  24159. }
  24160. protected function getContents($url, $fetchingRepoData = false)
  24161. {
  24162. try {
  24163. return parent::getContents($url);
  24164. } catch (TransportException $e) {
  24165. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24166. switch ($e->getCode()) {
  24167. case 401:
  24168. case 404:
  24169. if (!$fetchingRepoData) {
  24170. throw $e;
  24171. }
  24172. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  24173. return parent::getContents($url);
  24174. }
  24175. if (!$this->io->isInteractive()) {
  24176. return $this->attemptCloneFallback();
  24177. }
  24178. $scopesIssued = array();
  24179. $scopesNeeded = array();
  24180. if ($headers = $e->getHeaders()) {
  24181. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  24182. $scopesIssued = explode(' ', $scopes);
  24183. }
  24184. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  24185. $scopesNeeded = explode(' ', $scopes);
  24186. }
  24187. }
  24188. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  24189. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  24190. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24191. }
  24192. return parent::getContents($url);
  24193. case 403:
  24194. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  24195. return parent::getContents($url);
  24196. }
  24197. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24198. return $this->attemptCloneFallback();
  24199. }
  24200. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  24201. if (!$this->io->hasAuthentication($this->originUrl)) {
  24202. if (!$this->io->isInteractive()) {
  24203. $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>');
  24204. throw $e;
  24205. }
  24206. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  24207. return parent::getContents($url);
  24208. }
  24209. if ($rateLimited) {
  24210. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  24211. $this->io->writeError(sprintf(
  24212. '<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>',
  24213. $rateLimit['limit'],
  24214. $rateLimit['reset']
  24215. ));
  24216. }
  24217. throw $e;
  24218. default:
  24219. throw $e;
  24220. }
  24221. }
  24222. }
  24223. protected function fetchRootIdentifier()
  24224. {
  24225. if ($this->repoData) {
  24226. return;
  24227. }
  24228. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  24229. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  24230. if (null === $this->repoData && null !== $this->gitDriver) {
  24231. return;
  24232. }
  24233. $this->owner = $this->repoData['owner']['login'];
  24234. $this->repository = $this->repoData['name'];
  24235. $this->isPrivate = !empty($this->repoData['private']);
  24236. if (isset($this->repoData['default_branch'])) {
  24237. $this->rootIdentifier = $this->repoData['default_branch'];
  24238. } elseif (isset($this->repoData['master_branch'])) {
  24239. $this->rootIdentifier = $this->repoData['master_branch'];
  24240. } else {
  24241. $this->rootIdentifier = 'master';
  24242. }
  24243. $this->hasIssues = !empty($this->repoData['has_issues']);
  24244. $this->isArchived = !empty($this->repoData['archived']);
  24245. }
  24246. protected function attemptCloneFallback()
  24247. {
  24248. $this->isPrivate = true;
  24249. try {
  24250. $this->setupGitDriver($this->generateSshUrl());
  24251. return;
  24252. } catch (\RuntimeException $e) {
  24253. $this->gitDriver = null;
  24254. $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>');
  24255. throw $e;
  24256. }
  24257. }
  24258. protected function setupGitDriver($url)
  24259. {
  24260. $this->gitDriver = new GitDriver(
  24261. array('url' => $url),
  24262. $this->io,
  24263. $this->config,
  24264. $this->process,
  24265. $this->remoteFilesystem
  24266. );
  24267. $this->gitDriver->initialize();
  24268. }
  24269. protected function getNextPage()
  24270. {
  24271. $headers = $this->remoteFilesystem->getLastHeaders();
  24272. foreach ($headers as $header) {
  24273. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24274. $links = explode(',', $match[1]);
  24275. foreach ($links as $link) {
  24276. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24277. return $match[1];
  24278. }
  24279. }
  24280. }
  24281. }
  24282. }
  24283. }
  24284. <?php
  24285. namespace Composer\Repository\Vcs;
  24286. use Composer\Config;
  24287. use Composer\Cache;
  24288. use Composer\IO\IOInterface;
  24289. use Composer\Json\JsonFile;
  24290. use Composer\Downloader\TransportException;
  24291. use Composer\Util\RemoteFilesystem;
  24292. use Composer\Util\GitLab;
  24293. class GitLabDriver extends VcsDriver
  24294. {
  24295. private $scheme;
  24296. private $namespace;
  24297. private $repository;
  24298. private $project;
  24299. private $commits = array();
  24300. private $tags;
  24301. private $branches;
  24302. protected $gitDriver;
  24303. private $isPrivate = true;
  24304. private $hasNonstandardOrigin = false;
  24305. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  24306. public function initialize()
  24307. {
  24308. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  24309. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  24310. }
  24311. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24312. $configuredDomains = $this->config->get('gitlab-domains');
  24313. $urlParts = explode('/', $match['parts']);
  24314. $this->scheme = !empty($match['scheme'])
  24315. ? $match['scheme']
  24316. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  24317. ;
  24318. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  24319. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  24320. $this->hasNonstandardOrigin = true;
  24321. }
  24322. $this->namespace = implode('/', $urlParts);
  24323. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  24324. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  24325. $this->fetchProject();
  24326. }
  24327. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  24328. {
  24329. $this->remoteFilesystem = $remoteFilesystem;
  24330. }
  24331. public function getComposerInformation($identifier)
  24332. {
  24333. if ($this->gitDriver) {
  24334. return $this->gitDriver->getComposerInformation($identifier);
  24335. }
  24336. if (!isset($this->infoCache[$identifier])) {
  24337. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24338. $composer = JsonFile::parseJson($res);
  24339. } else {
  24340. $composer = $this->getBaseComposerInformation($identifier);
  24341. if ($this->shouldCache($identifier)) {
  24342. $this->cache->write($identifier, json_encode($composer));
  24343. }
  24344. }
  24345. if ($composer) {
  24346. if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
  24347. $composer['support']['issues'] = $this->project['_links']['issues'];
  24348. }
  24349. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  24350. $composer['abandoned'] = true;
  24351. }
  24352. }
  24353. $this->infoCache[$identifier] = $composer;
  24354. }
  24355. return $this->infoCache[$identifier];
  24356. }
  24357. public function getFileContent($file, $identifier)
  24358. {
  24359. if ($this->gitDriver) {
  24360. return $this->gitDriver->getFileContent($file, $identifier);
  24361. }
  24362. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  24363. $branches = $this->getBranches();
  24364. if (isset($branches[$identifier])) {
  24365. $identifier = $branches[$identifier];
  24366. }
  24367. }
  24368. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  24369. try {
  24370. $content = $this->getContents($resource);
  24371. } catch (TransportException $e) {
  24372. if ($e->getCode() !== 404) {
  24373. throw $e;
  24374. }
  24375. return null;
  24376. }
  24377. return $content;
  24378. }
  24379. public function getChangeDate($identifier)
  24380. {
  24381. if ($this->gitDriver) {
  24382. return $this->gitDriver->getChangeDate($identifier);
  24383. }
  24384. if (isset($this->commits[$identifier])) {
  24385. return new \DateTime($this->commits[$identifier]['committed_date']);
  24386. }
  24387. return new \DateTime();
  24388. }
  24389. public function getRepositoryUrl()
  24390. {
  24391. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  24392. }
  24393. public function getUrl()
  24394. {
  24395. if ($this->gitDriver) {
  24396. return $this->gitDriver->getUrl();
  24397. }
  24398. return $this->project['web_url'];
  24399. }
  24400. public function getDist($identifier)
  24401. {
  24402. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  24403. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  24404. }
  24405. public function getSource($identifier)
  24406. {
  24407. if ($this->gitDriver) {
  24408. return $this->gitDriver->getSource($identifier);
  24409. }
  24410. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  24411. }
  24412. public function getRootIdentifier()
  24413. {
  24414. if ($this->gitDriver) {
  24415. return $this->gitDriver->getRootIdentifier();
  24416. }
  24417. return $this->project['default_branch'];
  24418. }
  24419. public function getBranches()
  24420. {
  24421. if ($this->gitDriver) {
  24422. return $this->gitDriver->getBranches();
  24423. }
  24424. if (!$this->branches) {
  24425. $this->branches = $this->getReferences('branches');
  24426. }
  24427. return $this->branches;
  24428. }
  24429. public function getTags()
  24430. {
  24431. if ($this->gitDriver) {
  24432. return $this->gitDriver->getTags();
  24433. }
  24434. if (!$this->tags) {
  24435. $this->tags = $this->getReferences('tags');
  24436. }
  24437. return $this->tags;
  24438. }
  24439. public function getApiUrl()
  24440. {
  24441. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  24442. }
  24443. private function urlEncodeAll($string)
  24444. {
  24445. $encoded = '';
  24446. for ($i = 0; isset($string[$i]); $i++) {
  24447. $character = $string[$i];
  24448. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  24449. $character = '%' . sprintf('%02X', ord($character));
  24450. }
  24451. $encoded .= $character;
  24452. }
  24453. return $encoded;
  24454. }
  24455. protected function getReferences($type)
  24456. {
  24457. $perPage = 100;
  24458. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  24459. $references = array();
  24460. do {
  24461. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  24462. foreach ($data as $datum) {
  24463. $references[$datum['name']] = $datum['commit']['id'];
  24464. $this->commits[$datum['commit']['id']] = $datum['commit'];
  24465. }
  24466. if (count($data) >= $perPage) {
  24467. $resource = $this->getNextPage();
  24468. } else {
  24469. $resource = false;
  24470. }
  24471. } while ($resource);
  24472. return $references;
  24473. }
  24474. protected function fetchProject()
  24475. {
  24476. $resource = $this->getApiUrl();
  24477. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  24478. if (isset($this->project['visibility'])) {
  24479. $this->isPrivate = $this->project['visibility'] !== 'public';
  24480. } else {
  24481. $this->isPrivate = false;
  24482. }
  24483. }
  24484. protected function attemptCloneFallback()
  24485. {
  24486. try {
  24487. if ($this->isPrivate === false) {
  24488. $url = $this->generatePublicUrl();
  24489. } else {
  24490. $url = $this->generateSshUrl();
  24491. }
  24492. $this->setupGitDriver($url);
  24493. return;
  24494. } catch (\RuntimeException $e) {
  24495. $this->gitDriver = null;
  24496. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  24497. throw $e;
  24498. }
  24499. }
  24500. protected function generateSshUrl()
  24501. {
  24502. if ($this->hasNonstandardOrigin) {
  24503. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  24504. }
  24505. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  24506. }
  24507. protected function generatePublicUrl()
  24508. {
  24509. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  24510. }
  24511. protected function setupGitDriver($url)
  24512. {
  24513. $this->gitDriver = new GitDriver(
  24514. array('url' => $url),
  24515. $this->io,
  24516. $this->config,
  24517. $this->process,
  24518. $this->remoteFilesystem
  24519. );
  24520. $this->gitDriver->initialize();
  24521. }
  24522. protected function getContents($url, $fetchingRepoData = false)
  24523. {
  24524. try {
  24525. $res = parent::getContents($url);
  24526. if ($fetchingRepoData) {
  24527. $json = JsonFile::parseJson($res, $url);
  24528. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  24529. $this->isPrivate = $json['visibility'] !== 'public';
  24530. $moreThanGuestAccess = false;
  24531. foreach ($json['permissions'] as $permission) {
  24532. if ($permission && $permission['access_level'] > 10) {
  24533. $moreThanGuestAccess = true;
  24534. }
  24535. }
  24536. if (!$moreThanGuestAccess) {
  24537. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  24538. return $this->attemptCloneFallback();
  24539. }
  24540. }
  24541. if (!isset($json['default_branch'])) {
  24542. if (!empty($json['id'])) {
  24543. $this->isPrivate = false;
  24544. }
  24545. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  24546. }
  24547. }
  24548. return $res;
  24549. } catch (TransportException $e) {
  24550. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24551. switch ($e->getCode()) {
  24552. case 401:
  24553. case 404:
  24554. if (!$fetchingRepoData) {
  24555. throw $e;
  24556. }
  24557. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  24558. return parent::getContents($url);
  24559. }
  24560. if (!$this->io->isInteractive()) {
  24561. return $this->attemptCloneFallback();
  24562. }
  24563. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  24564. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24565. return parent::getContents($url);
  24566. case 403:
  24567. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  24568. return parent::getContents($url);
  24569. }
  24570. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24571. return $this->attemptCloneFallback();
  24572. }
  24573. throw $e;
  24574. default:
  24575. throw $e;
  24576. }
  24577. }
  24578. }
  24579. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24580. {
  24581. if (!preg_match(self::URL_REGEX, $url, $match)) {
  24582. return false;
  24583. }
  24584. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  24585. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24586. $urlParts = explode('/', $match['parts']);
  24587. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  24588. return false;
  24589. }
  24590. if ('https' === $scheme && !extension_loaded('openssl')) {
  24591. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24592. return false;
  24593. }
  24594. return true;
  24595. }
  24596. private function getNextPage()
  24597. {
  24598. $headers = $this->remoteFilesystem->getLastHeaders();
  24599. foreach ($headers as $header) {
  24600. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24601. $links = explode(',', $match[1]);
  24602. foreach ($links as $link) {
  24603. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24604. return $match[1];
  24605. }
  24606. }
  24607. }
  24608. }
  24609. }
  24610. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  24611. {
  24612. $guessedDomain = strtolower($guessedDomain);
  24613. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  24614. if ($portNumber) {
  24615. return $guessedDomain.':'.$portNumber;
  24616. }
  24617. return $guessedDomain;
  24618. }
  24619. if ($portNumber) {
  24620. $guessedDomain .= ':'.$portNumber;
  24621. }
  24622. while (null !== ($part = array_shift($urlParts))) {
  24623. $guessedDomain .= '/' . $part;
  24624. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  24625. return $guessedDomain;
  24626. }
  24627. }
  24628. return false;
  24629. }
  24630. }
  24631. <?php
  24632. namespace Composer\Repository\Vcs;
  24633. use Composer\Config;
  24634. use Composer\IO\IOInterface;
  24635. class HgBitbucketDriver extends BitbucketDriver
  24636. {
  24637. public function getRootIdentifier()
  24638. {
  24639. if ($this->fallbackDriver) {
  24640. return $this->fallbackDriver->getRootIdentifier();
  24641. }
  24642. if (null === $this->rootIdentifier) {
  24643. if (! $this->getRepoData()) {
  24644. return $this->fallbackDriver->getRootIdentifier();
  24645. }
  24646. if ($this->vcsType !== 'hg') {
  24647. throw new \RuntimeException(
  24648. $this->url.' does not appear to be a mercurial repository, use '.
  24649. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  24650. );
  24651. }
  24652. $mainBranchData = $this->getMainBranchData();
  24653. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  24654. }
  24655. return $this->rootIdentifier;
  24656. }
  24657. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24658. {
  24659. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  24660. return false;
  24661. }
  24662. if (!extension_loaded('openssl')) {
  24663. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24664. return false;
  24665. }
  24666. return true;
  24667. }
  24668. protected function setupFallbackDriver($url)
  24669. {
  24670. $this->fallbackDriver = new HgDriver(
  24671. array('url' => $url),
  24672. $this->io,
  24673. $this->config,
  24674. $this->process,
  24675. $this->remoteFilesystem
  24676. );
  24677. $this->fallbackDriver->initialize();
  24678. }
  24679. protected function generateSshUrl()
  24680. {
  24681. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  24682. }
  24683. }
  24684. <?php
  24685. namespace Composer\Repository\Vcs;
  24686. use Composer\Config;
  24687. use Composer\Cache;
  24688. use Composer\Util\Hg as HgUtils;
  24689. use Composer\Util\ProcessExecutor;
  24690. use Composer\Util\Filesystem;
  24691. use Composer\IO\IOInterface;
  24692. class HgDriver extends VcsDriver
  24693. {
  24694. protected $tags;
  24695. protected $branches;
  24696. protected $rootIdentifier;
  24697. protected $repoDir;
  24698. protected $infoCache = array();
  24699. public function initialize()
  24700. {
  24701. if (Filesystem::isLocalPath($this->url)) {
  24702. $this->repoDir = $this->url;
  24703. } else {
  24704. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24705. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24706. }
  24707. $cacheDir = $this->config->get('cache-vcs-dir');
  24708. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  24709. $fs = new Filesystem();
  24710. $fs->ensureDirectoryExists($cacheDir);
  24711. if (!is_writable(dirname($this->repoDir))) {
  24712. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  24713. }
  24714. $this->config->prohibitUrlByConfig($this->url, $this->io);
  24715. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  24716. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  24717. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  24718. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  24719. }
  24720. } else {
  24721. $fs->removeDirectory($this->repoDir);
  24722. $repoDir = $this->repoDir;
  24723. $command = function ($url) use ($repoDir) {
  24724. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  24725. };
  24726. $hgUtils->runCommand($command, $this->url, null);
  24727. }
  24728. }
  24729. $this->getTags();
  24730. $this->getBranches();
  24731. }
  24732. public function getRootIdentifier()
  24733. {
  24734. if (null === $this->rootIdentifier) {
  24735. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  24736. $output = $this->process->splitLines($output);
  24737. $this->rootIdentifier = $output[0];
  24738. }
  24739. return $this->rootIdentifier;
  24740. }
  24741. public function getUrl()
  24742. {
  24743. return $this->url;
  24744. }
  24745. public function getSource($identifier)
  24746. {
  24747. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  24748. }
  24749. public function getDist($identifier)
  24750. {
  24751. return null;
  24752. }
  24753. public function getFileContent($file, $identifier)
  24754. {
  24755. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  24756. $this->process->execute($resource, $content, $this->repoDir);
  24757. if (!trim($content)) {
  24758. return;
  24759. }
  24760. return $content;
  24761. }
  24762. public function getChangeDate($identifier)
  24763. {
  24764. $this->process->execute(
  24765. sprintf(
  24766. 'hg log --template "{date|rfc3339date}" -r %s',
  24767. ProcessExecutor::escape($identifier)
  24768. ),
  24769. $output,
  24770. $this->repoDir
  24771. );
  24772. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  24773. }
  24774. public function getTags()
  24775. {
  24776. if (null === $this->tags) {
  24777. $tags = array();
  24778. $this->process->execute('hg tags', $output, $this->repoDir);
  24779. foreach ($this->process->splitLines($output) as $tag) {
  24780. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  24781. $tags[$match[1]] = $match[2];
  24782. }
  24783. }
  24784. unset($tags['tip']);
  24785. $this->tags = $tags;
  24786. }
  24787. return $this->tags;
  24788. }
  24789. public function getBranches()
  24790. {
  24791. if (null === $this->branches) {
  24792. $branches = array();
  24793. $bookmarks = array();
  24794. $this->process->execute('hg branches', $output, $this->repoDir);
  24795. foreach ($this->process->splitLines($output) as $branch) {
  24796. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  24797. $branches[$match[1]] = $match[2];
  24798. }
  24799. }
  24800. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  24801. foreach ($this->process->splitLines($output) as $branch) {
  24802. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  24803. $bookmarks[$match[1]] = $match[2];
  24804. }
  24805. }
  24806. $this->branches = array_merge($bookmarks, $branches);
  24807. }
  24808. return $this->branches;
  24809. }
  24810. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24811. {
  24812. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  24813. return true;
  24814. }
  24815. if (Filesystem::isLocalPath($url)) {
  24816. $url = Filesystem::getPlatformPath($url);
  24817. if (!is_dir($url)) {
  24818. return false;
  24819. }
  24820. $process = new ProcessExecutor($io);
  24821. if ($process->execute('hg summary', $output, $url) === 0) {
  24822. return true;
  24823. }
  24824. }
  24825. if (!$deep) {
  24826. return false;
  24827. }
  24828. $processExecutor = new ProcessExecutor($io);
  24829. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  24830. return $exit === 0;
  24831. }
  24832. }
  24833. <?php
  24834. namespace Composer\Repository\Vcs;
  24835. use Composer\Config;
  24836. use Composer\Cache;
  24837. use Composer\IO\IOInterface;
  24838. use Composer\Util\ProcessExecutor;
  24839. use Composer\Util\Perforce;
  24840. class PerforceDriver extends VcsDriver
  24841. {
  24842. protected $depot;
  24843. protected $branch;
  24844. protected $perforce;
  24845. public function initialize()
  24846. {
  24847. $this->depot = $this->repoConfig['depot'];
  24848. $this->branch = '';
  24849. if (!empty($this->repoConfig['branch'])) {
  24850. $this->branch = $this->repoConfig['branch'];
  24851. }
  24852. $this->initPerforce($this->repoConfig);
  24853. $this->perforce->p4Login();
  24854. $this->perforce->checkStream();
  24855. $this->perforce->writeP4ClientSpec();
  24856. $this->perforce->connectClient();
  24857. return true;
  24858. }
  24859. private function initPerforce($repoConfig)
  24860. {
  24861. if (!empty($this->perforce)) {
  24862. return;
  24863. }
  24864. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24865. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24866. }
  24867. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  24868. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  24869. }
  24870. public function getFileContent($file, $identifier)
  24871. {
  24872. return $this->perforce->getFileContent($file, $identifier);
  24873. }
  24874. public function getChangeDate($identifier)
  24875. {
  24876. return null;
  24877. }
  24878. public function getRootIdentifier()
  24879. {
  24880. return $this->branch;
  24881. }
  24882. public function getBranches()
  24883. {
  24884. return $this->perforce->getBranches();
  24885. }
  24886. public function getTags()
  24887. {
  24888. return $this->perforce->getTags();
  24889. }
  24890. public function getDist($identifier)
  24891. {
  24892. return null;
  24893. }
  24894. public function getSource($identifier)
  24895. {
  24896. $source = array(
  24897. 'type' => 'perforce',
  24898. 'url' => $this->repoConfig['url'],
  24899. 'reference' => $identifier,
  24900. 'p4user' => $this->perforce->getUser(),
  24901. );
  24902. return $source;
  24903. }
  24904. public function getUrl()
  24905. {
  24906. return $this->url;
  24907. }
  24908. public function hasComposerFile($identifier)
  24909. {
  24910. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  24911. $composerInfoIdentifier = $identifier;
  24912. return !empty($composerInfo);
  24913. }
  24914. public function getContents($url)
  24915. {
  24916. return false;
  24917. }
  24918. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24919. {
  24920. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  24921. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  24922. }
  24923. return false;
  24924. }
  24925. public function cleanup()
  24926. {
  24927. $this->perforce->cleanupClientSpec();
  24928. $this->perforce = null;
  24929. }
  24930. public function getDepot()
  24931. {
  24932. return $this->depot;
  24933. }
  24934. public function getBranch()
  24935. {
  24936. return $this->branch;
  24937. }
  24938. }
  24939. <?php
  24940. namespace Composer\Repository\Vcs;
  24941. use Composer\Cache;
  24942. use Composer\Config;
  24943. use Composer\Json\JsonFile;
  24944. use Composer\Util\ProcessExecutor;
  24945. use Composer\Util\Filesystem;
  24946. use Composer\Util\Svn as SvnUtil;
  24947. use Composer\IO\IOInterface;
  24948. use Composer\Downloader\TransportException;
  24949. class SvnDriver extends VcsDriver
  24950. {
  24951. protected $cache;
  24952. protected $baseUrl;
  24953. protected $tags;
  24954. protected $branches;
  24955. protected $rootIdentifier;
  24956. protected $infoCache = array();
  24957. protected $trunkPath = 'trunk';
  24958. protected $branchesPath = 'branches';
  24959. protected $tagsPath = 'tags';
  24960. protected $packagePath = '';
  24961. protected $cacheCredentials = true;
  24962. private $util;
  24963. public function initialize()
  24964. {
  24965. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24966. SvnUtil::cleanEnv();
  24967. if (isset($this->repoConfig['trunk-path'])) {
  24968. $this->trunkPath = $this->repoConfig['trunk-path'];
  24969. }
  24970. if (isset($this->repoConfig['branches-path'])) {
  24971. $this->branchesPath = $this->repoConfig['branches-path'];
  24972. }
  24973. if (isset($this->repoConfig['tags-path'])) {
  24974. $this->tagsPath = $this->repoConfig['tags-path'];
  24975. }
  24976. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  24977. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  24978. }
  24979. if (isset($this->repoConfig['package-path'])) {
  24980. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  24981. }
  24982. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  24983. $this->baseUrl = substr($this->url, 0, $pos);
  24984. }
  24985. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  24986. $this->getBranches();
  24987. $this->getTags();
  24988. }
  24989. public function getRootIdentifier()
  24990. {
  24991. return $this->rootIdentifier ?: $this->trunkPath;
  24992. }
  24993. public function getUrl()
  24994. {
  24995. return $this->url;
  24996. }
  24997. public function getSource($identifier)
  24998. {
  24999. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  25000. }
  25001. public function getDist($identifier)
  25002. {
  25003. return null;
  25004. }
  25005. protected function shouldCache($identifier)
  25006. {
  25007. return $this->cache && preg_match('{@\d+$}', $identifier);
  25008. }
  25009. public function getComposerInformation($identifier)
  25010. {
  25011. if (!isset($this->infoCache[$identifier])) {
  25012. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  25013. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25014. }
  25015. try {
  25016. $composer = $this->getBaseComposerInformation($identifier);
  25017. } catch (TransportException $e) {
  25018. $message = $e->getMessage();
  25019. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  25020. throw $e;
  25021. }
  25022. $composer = '';
  25023. }
  25024. if ($this->shouldCache($identifier)) {
  25025. $this->cache->write($identifier.'.json', json_encode($composer));
  25026. }
  25027. $this->infoCache[$identifier] = $composer;
  25028. }
  25029. return $this->infoCache[$identifier];
  25030. }
  25031. public function getFileContent($file, $identifier)
  25032. {
  25033. $identifier = '/' . trim($identifier, '/') . '/';
  25034. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25035. if (!empty($match[2])) {
  25036. $path = $match[1];
  25037. $rev = $match[2];
  25038. } else {
  25039. $path = $identifier;
  25040. $rev = '';
  25041. }
  25042. try {
  25043. $resource = $path.$file;
  25044. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  25045. if (!trim($output)) {
  25046. return null;
  25047. }
  25048. } catch (\RuntimeException $e) {
  25049. throw new TransportException($e->getMessage());
  25050. }
  25051. return $output;
  25052. }
  25053. public function getChangeDate($identifier)
  25054. {
  25055. $identifier = '/' . trim($identifier, '/') . '/';
  25056. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25057. if (!empty($match[2])) {
  25058. $path = $match[1];
  25059. $rev = $match[2];
  25060. } else {
  25061. $path = $identifier;
  25062. $rev = '';
  25063. }
  25064. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  25065. foreach ($this->process->splitLines($output) as $line) {
  25066. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  25067. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  25068. }
  25069. }
  25070. return null;
  25071. }
  25072. public function getTags()
  25073. {
  25074. if (null === $this->tags) {
  25075. $this->tags = array();
  25076. if ($this->tagsPath !== false) {
  25077. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  25078. if ($output) {
  25079. foreach ($this->process->splitLines($output) as $line) {
  25080. $line = trim($line);
  25081. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25082. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25083. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  25084. '/' . $this->tagsPath . '/' . $match[2],
  25085. $match[1]
  25086. );
  25087. }
  25088. }
  25089. }
  25090. }
  25091. }
  25092. }
  25093. return $this->tags;
  25094. }
  25095. public function getBranches()
  25096. {
  25097. if (null === $this->branches) {
  25098. $this->branches = array();
  25099. if (false === $this->trunkPath) {
  25100. $trunkParent = $this->baseUrl . '/';
  25101. } else {
  25102. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  25103. }
  25104. $output = $this->execute('svn ls --verbose', $trunkParent);
  25105. if ($output) {
  25106. foreach ($this->process->splitLines($output) as $line) {
  25107. $line = trim($line);
  25108. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25109. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  25110. $this->branches['trunk'] = $this->buildIdentifier(
  25111. '/' . $this->trunkPath,
  25112. $match[1]
  25113. );
  25114. $this->rootIdentifier = $this->branches['trunk'];
  25115. break;
  25116. }
  25117. }
  25118. }
  25119. }
  25120. unset($output);
  25121. if ($this->branchesPath !== false) {
  25122. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  25123. if ($output) {
  25124. foreach ($this->process->splitLines(trim($output)) as $line) {
  25125. $line = trim($line);
  25126. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25127. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25128. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  25129. '/' . $this->branchesPath . '/' . $match[2],
  25130. $match[1]
  25131. );
  25132. }
  25133. }
  25134. }
  25135. }
  25136. }
  25137. }
  25138. return $this->branches;
  25139. }
  25140. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  25141. {
  25142. $url = self::normalizeUrl($url);
  25143. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  25144. return true;
  25145. }
  25146. if (!$deep && !Filesystem::isLocalPath($url)) {
  25147. return false;
  25148. }
  25149. $processExecutor = new ProcessExecutor($io);
  25150. $exit = $processExecutor->execute(
  25151. "svn info --non-interactive ".ProcessExecutor::escape($url),
  25152. $ignoredOutput
  25153. );
  25154. if ($exit === 0) {
  25155. return true;
  25156. }
  25157. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  25158. return true;
  25159. }
  25160. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  25161. return true;
  25162. }
  25163. return false;
  25164. }
  25165. protected static function normalizeUrl($url)
  25166. {
  25167. $fs = new Filesystem();
  25168. if ($fs->isAbsolutePath($url)) {
  25169. return 'file://' . strtr($url, '\\', '/');
  25170. }
  25171. return $url;
  25172. }
  25173. protected function execute($command, $url)
  25174. {
  25175. if (null === $this->util) {
  25176. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  25177. $this->util->setCacheCredentials($this->cacheCredentials);
  25178. }
  25179. try {
  25180. return $this->util->execute($command, $url);
  25181. } catch (\RuntimeException $e) {
  25182. if (null === $this->util->binaryVersion()) {
  25183. 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());
  25184. }
  25185. throw new \RuntimeException(
  25186. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  25187. );
  25188. }
  25189. }
  25190. protected function buildIdentifier($baseDir, $revision)
  25191. {
  25192. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  25193. }
  25194. }
  25195. <?php
  25196. namespace Composer\Repository\Vcs;
  25197. use Composer\Cache;
  25198. use Composer\Downloader\TransportException;
  25199. use Composer\Config;
  25200. use Composer\Factory;
  25201. use Composer\IO\IOInterface;
  25202. use Composer\Json\JsonFile;
  25203. use Composer\Util\ProcessExecutor;
  25204. use Composer\Util\RemoteFilesystem;
  25205. use Composer\Util\Filesystem;
  25206. abstract class VcsDriver implements VcsDriverInterface
  25207. {
  25208. protected $url;
  25209. protected $originUrl;
  25210. protected $repoConfig;
  25211. protected $io;
  25212. protected $config;
  25213. protected $process;
  25214. protected $remoteFilesystem;
  25215. protected $infoCache = array();
  25216. protected $cache;
  25217. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25218. {
  25219. if (Filesystem::isLocalPath($repoConfig['url'])) {
  25220. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  25221. }
  25222. $this->url = $repoConfig['url'];
  25223. $this->originUrl = $repoConfig['url'];
  25224. $this->repoConfig = $repoConfig;
  25225. $this->io = $io;
  25226. $this->config = $config;
  25227. $this->process = $process ?: new ProcessExecutor($io);
  25228. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25229. }
  25230. protected function shouldCache($identifier)
  25231. {
  25232. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  25233. }
  25234. public function getComposerInformation($identifier)
  25235. {
  25236. if (!isset($this->infoCache[$identifier])) {
  25237. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  25238. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25239. }
  25240. $composer = $this->getBaseComposerInformation($identifier);
  25241. if ($this->shouldCache($identifier)) {
  25242. $this->cache->write($identifier, json_encode($composer));
  25243. }
  25244. $this->infoCache[$identifier] = $composer;
  25245. }
  25246. return $this->infoCache[$identifier];
  25247. }
  25248. protected function getBaseComposerInformation($identifier)
  25249. {
  25250. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25251. if (!$composerFileContent) {
  25252. return null;
  25253. }
  25254. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  25255. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  25256. $composer['time'] = $changeDate->format(DATE_RFC3339);
  25257. }
  25258. return $composer;
  25259. }
  25260. public function hasComposerFile($identifier)
  25261. {
  25262. try {
  25263. return (bool) $this->getComposerInformation($identifier);
  25264. } catch (TransportException $e) {
  25265. }
  25266. return false;
  25267. }
  25268. protected function getScheme()
  25269. {
  25270. if (extension_loaded('openssl')) {
  25271. return 'https';
  25272. }
  25273. return 'http';
  25274. }
  25275. protected function getContents($url)
  25276. {
  25277. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  25278. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  25279. }
  25280. public function cleanup()
  25281. {
  25282. return;
  25283. }
  25284. }
  25285. <?php
  25286. namespace Composer\Repository\Vcs;
  25287. use Composer\Config;
  25288. use Composer\IO\IOInterface;
  25289. interface VcsDriverInterface
  25290. {
  25291. public function initialize();
  25292. public function getComposerInformation($identifier);
  25293. public function getFileContent($file, $identifier);
  25294. public function getChangeDate($identifier);
  25295. public function getRootIdentifier();
  25296. public function getBranches();
  25297. public function getTags();
  25298. public function getDist($identifier);
  25299. public function getSource($identifier);
  25300. public function getUrl();
  25301. public function hasComposerFile($identifier);
  25302. public function cleanup();
  25303. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  25304. }
  25305. <?php
  25306. namespace Composer\Repository;
  25307. use Composer\Downloader\TransportException;
  25308. use Composer\Repository\Vcs\VcsDriverInterface;
  25309. use Composer\Package\Version\VersionParser;
  25310. use Composer\Package\Loader\ArrayLoader;
  25311. use Composer\Package\Loader\ValidatingArrayLoader;
  25312. use Composer\Package\Loader\InvalidPackageException;
  25313. use Composer\Package\Loader\LoaderInterface;
  25314. use Composer\EventDispatcher\EventDispatcher;
  25315. use Composer\Semver\Constraint\Constraint;
  25316. use Composer\IO\IOInterface;
  25317. use Composer\Config;
  25318. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25319. {
  25320. protected $url;
  25321. protected $packageName;
  25322. protected $isVerbose;
  25323. protected $isVeryVerbose;
  25324. protected $io;
  25325. protected $config;
  25326. protected $versionParser;
  25327. protected $type;
  25328. protected $loader;
  25329. protected $repoConfig;
  25330. protected $branchErrorOccurred = false;
  25331. private $drivers;
  25332. private $driver;
  25333. private $versionCache;
  25334. private $emptyReferences = array();
  25335. private $versionTransportExceptions = array();
  25336. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  25337. {
  25338. parent::__construct();
  25339. $this->drivers = $drivers ?: array(
  25340. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  25341. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  25342. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  25343. 'git' => 'Composer\Repository\Vcs\GitDriver',
  25344. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  25345. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  25346. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  25347. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  25348. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  25349. );
  25350. $this->url = $repoConfig['url'];
  25351. $this->io = $io;
  25352. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  25353. $this->isVerbose = $io->isVerbose();
  25354. $this->isVeryVerbose = $io->isVeryVerbose();
  25355. $this->config = $config;
  25356. $this->repoConfig = $repoConfig;
  25357. $this->versionCache = $versionCache;
  25358. }
  25359. public function getRepoConfig()
  25360. {
  25361. return $this->repoConfig;
  25362. }
  25363. public function setLoader(LoaderInterface $loader)
  25364. {
  25365. $this->loader = $loader;
  25366. }
  25367. public function getDriver()
  25368. {
  25369. if ($this->driver) {
  25370. return $this->driver;
  25371. }
  25372. if (isset($this->drivers[$this->type])) {
  25373. $class = $this->drivers[$this->type];
  25374. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  25375. $this->driver->initialize();
  25376. return $this->driver;
  25377. }
  25378. foreach ($this->drivers as $driver) {
  25379. if ($driver::supports($this->io, $this->config, $this->url)) {
  25380. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25381. $this->driver->initialize();
  25382. return $this->driver;
  25383. }
  25384. }
  25385. foreach ($this->drivers as $driver) {
  25386. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  25387. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25388. $this->driver->initialize();
  25389. return $this->driver;
  25390. }
  25391. }
  25392. }
  25393. public function hadInvalidBranches()
  25394. {
  25395. return $this->branchErrorOccurred;
  25396. }
  25397. public function getEmptyReferences()
  25398. {
  25399. return $this->emptyReferences;
  25400. }
  25401. public function getVersionTransportExceptions()
  25402. {
  25403. return $this->versionTransportExceptions;
  25404. }
  25405. protected function initialize()
  25406. {
  25407. parent::initialize();
  25408. $isVerbose = $this->isVerbose;
  25409. $isVeryVerbose = $this->isVeryVerbose;
  25410. $driver = $this->getDriver();
  25411. if (!$driver) {
  25412. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  25413. }
  25414. $this->versionParser = new VersionParser;
  25415. if (!$this->loader) {
  25416. $this->loader = new ArrayLoader($this->versionParser);
  25417. }
  25418. try {
  25419. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  25420. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  25421. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  25422. }
  25423. } catch (\Exception $e) {
  25424. if ($isVeryVerbose) {
  25425. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  25426. }
  25427. }
  25428. foreach ($driver->getTags() as $tag => $identifier) {
  25429. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  25430. if ($isVeryVerbose) {
  25431. $this->io->writeError($msg);
  25432. } elseif ($isVerbose) {
  25433. $this->io->overwriteError($msg, false);
  25434. }
  25435. $tag = str_replace('release-', '', $tag);
  25436. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  25437. if ($cachedPackage) {
  25438. $this->addPackage($cachedPackage);
  25439. continue;
  25440. } elseif ($cachedPackage === false) {
  25441. $this->emptyReferences[] = $identifier;
  25442. continue;
  25443. }
  25444. if (!$parsedTag = $this->validateTag($tag)) {
  25445. if ($isVeryVerbose) {
  25446. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  25447. }
  25448. continue;
  25449. }
  25450. try {
  25451. if (!$data = $driver->getComposerInformation($identifier)) {
  25452. if ($isVeryVerbose) {
  25453. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  25454. }
  25455. $this->emptyReferences[] = $identifier;
  25456. continue;
  25457. }
  25458. if (isset($data['version'])) {
  25459. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  25460. } else {
  25461. $data['version'] = $tag;
  25462. $data['version_normalized'] = $parsedTag;
  25463. }
  25464. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  25465. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  25466. if ($data['version_normalized'] !== $parsedTag) {
  25467. if ($isVeryVerbose) {
  25468. if (preg_match('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  25469. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  25470. } else {
  25471. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  25472. }
  25473. }
  25474. continue;
  25475. }
  25476. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  25477. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  25478. if ($isVeryVerbose) {
  25479. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  25480. }
  25481. continue;
  25482. }
  25483. if ($isVeryVerbose) {
  25484. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  25485. }
  25486. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  25487. } catch (\Exception $e) {
  25488. if ($e instanceof TransportException) {
  25489. $this->versionTransportExceptions['tags'][$tag] = $e;
  25490. if ($e->getCode() === 404) {
  25491. $this->emptyReferences[] = $identifier;
  25492. }
  25493. }
  25494. if ($isVeryVerbose) {
  25495. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  25496. }
  25497. continue;
  25498. }
  25499. }
  25500. if (!$isVeryVerbose) {
  25501. $this->io->overwriteError('', false);
  25502. }
  25503. $branches = $driver->getBranches();
  25504. foreach ($branches as $branch => $identifier) {
  25505. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  25506. if ($isVeryVerbose) {
  25507. $this->io->writeError($msg);
  25508. } elseif ($isVerbose) {
  25509. $this->io->overwriteError($msg, false);
  25510. }
  25511. if ($branch === 'trunk' && isset($branches['master'])) {
  25512. if ($isVeryVerbose) {
  25513. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  25514. }
  25515. continue;
  25516. }
  25517. if (!$parsedBranch = $this->validateBranch($branch)) {
  25518. if ($isVeryVerbose) {
  25519. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  25520. }
  25521. continue;
  25522. }
  25523. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  25524. $version = 'dev-' . $branch;
  25525. } else {
  25526. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  25527. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  25528. }
  25529. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  25530. if ($cachedPackage) {
  25531. $this->addPackage($cachedPackage);
  25532. continue;
  25533. } elseif ($cachedPackage === false) {
  25534. $this->emptyReferences[] = $identifier;
  25535. continue;
  25536. }
  25537. try {
  25538. if (!$data = $driver->getComposerInformation($identifier)) {
  25539. if ($isVeryVerbose) {
  25540. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  25541. }
  25542. $this->emptyReferences[] = $identifier;
  25543. continue;
  25544. }
  25545. $data['version'] = $version;
  25546. $data['version_normalized'] = $parsedBranch;
  25547. if ($isVeryVerbose) {
  25548. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  25549. }
  25550. $packageData = $this->preProcess($driver, $data, $identifier);
  25551. $package = $this->loader->load($packageData);
  25552. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  25553. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  25554. }
  25555. $this->addPackage($package);
  25556. } catch (TransportException $e) {
  25557. $this->versionTransportExceptions['branches'][$branch] = $e;
  25558. if ($e->getCode() === 404) {
  25559. $this->emptyReferences[] = $identifier;
  25560. }
  25561. if ($isVeryVerbose) {
  25562. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  25563. }
  25564. continue;
  25565. } catch (\Exception $e) {
  25566. if (!$isVeryVerbose) {
  25567. $this->io->writeError('');
  25568. }
  25569. $this->branchErrorOccurred = true;
  25570. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  25571. $this->io->writeError('');
  25572. continue;
  25573. }
  25574. }
  25575. $driver->cleanup();
  25576. if (!$isVeryVerbose) {
  25577. $this->io->overwriteError('', false);
  25578. }
  25579. if (!$this->getPackages()) {
  25580. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  25581. }
  25582. }
  25583. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  25584. {
  25585. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  25586. $data['name'] = $this->packageName ?: $dataPackageName;
  25587. if (!isset($data['dist'])) {
  25588. $data['dist'] = $driver->getDist($identifier);
  25589. }
  25590. if (!isset($data['source'])) {
  25591. $data['source'] = $driver->getSource($identifier);
  25592. }
  25593. return $data;
  25594. }
  25595. private function validateBranch($branch)
  25596. {
  25597. try {
  25598. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  25599. $this->versionParser->parseConstraints($normalizedBranch);
  25600. return $normalizedBranch;
  25601. } catch (\Exception $e) {
  25602. }
  25603. return false;
  25604. }
  25605. private function validateTag($version)
  25606. {
  25607. try {
  25608. return $this->versionParser->normalize($version);
  25609. } catch (\Exception $e) {
  25610. }
  25611. return false;
  25612. }
  25613. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  25614. {
  25615. if (!$this->versionCache) {
  25616. return;
  25617. }
  25618. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  25619. if ($cachedPackage === false) {
  25620. if ($isVeryVerbose) {
  25621. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  25622. }
  25623. return false;
  25624. }
  25625. if ($cachedPackage) {
  25626. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  25627. if ($isVeryVerbose) {
  25628. $this->io->writeError($msg);
  25629. } elseif ($isVerbose) {
  25630. $this->io->overwriteError($msg, false);
  25631. }
  25632. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  25633. if ($isVeryVerbose) {
  25634. $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>');
  25635. }
  25636. $cachedPackage = null;
  25637. }
  25638. }
  25639. if ($cachedPackage) {
  25640. return $this->loader->load($cachedPackage);
  25641. }
  25642. return null;
  25643. }
  25644. }
  25645. <?php
  25646. namespace Composer\Repository;
  25647. interface VersionCacheInterface
  25648. {
  25649. public function getVersionPackage($version, $identifier);
  25650. }
  25651. <?php
  25652. namespace Composer\Repository;
  25653. use Composer\Package\AliasPackage;
  25654. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  25655. {
  25656. public function write()
  25657. {
  25658. }
  25659. public function reload()
  25660. {
  25661. }
  25662. public function getCanonicalPackages()
  25663. {
  25664. $packages = $this->getPackages();
  25665. $packagesByName = array();
  25666. foreach ($packages as $package) {
  25667. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  25668. $packagesByName[$package->getName()] = $package;
  25669. }
  25670. }
  25671. $canonicalPackages = array();
  25672. foreach ($packagesByName as $package) {
  25673. while ($package instanceof AliasPackage) {
  25674. $package = $package->getAliasOf();
  25675. }
  25676. $canonicalPackages[] = $package;
  25677. }
  25678. return $canonicalPackages;
  25679. }
  25680. }
  25681. <?php
  25682. namespace Composer\Repository;
  25683. use Composer\Package\PackageInterface;
  25684. interface WritableRepositoryInterface extends RepositoryInterface
  25685. {
  25686. public function write();
  25687. public function addPackage(PackageInterface $package);
  25688. public function removePackage(PackageInterface $package);
  25689. public function getCanonicalPackages();
  25690. public function reload();
  25691. }
  25692. <?php
  25693. namespace Composer\Script;
  25694. class CommandEvent extends Event
  25695. {
  25696. }
  25697. <?php
  25698. namespace Composer\Script;
  25699. use Composer\Composer;
  25700. use Composer\IO\IOInterface;
  25701. use Composer\EventDispatcher\Event as BaseEvent;
  25702. class Event extends BaseEvent
  25703. {
  25704. private $composer;
  25705. private $io;
  25706. private $devMode;
  25707. private $originatingEvent;
  25708. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  25709. {
  25710. parent::__construct($name, $args, $flags);
  25711. $this->composer = $composer;
  25712. $this->io = $io;
  25713. $this->devMode = $devMode;
  25714. $this->originatingEvent = null;
  25715. }
  25716. public function getComposer()
  25717. {
  25718. return $this->composer;
  25719. }
  25720. public function getIO()
  25721. {
  25722. return $this->io;
  25723. }
  25724. public function isDevMode()
  25725. {
  25726. return $this->devMode;
  25727. }
  25728. public function getOriginatingEvent()
  25729. {
  25730. return $this->originatingEvent;
  25731. }
  25732. public function setOriginatingEvent(BaseEvent $event)
  25733. {
  25734. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  25735. return $this;
  25736. }
  25737. private function calculateOriginatingEvent(BaseEvent $event)
  25738. {
  25739. if ($event instanceof Event && $event->getOriginatingEvent()) {
  25740. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  25741. }
  25742. return $event;
  25743. }
  25744. }
  25745. <?php
  25746. namespace Composer\Script;
  25747. use Composer\Installer\PackageEvent as BasePackageEvent;
  25748. class PackageEvent extends BasePackageEvent
  25749. {
  25750. }
  25751. <?php
  25752. namespace Composer\Script;
  25753. class ScriptEvents
  25754. {
  25755. const PRE_INSTALL_CMD = 'pre-install-cmd';
  25756. const POST_INSTALL_CMD = 'post-install-cmd';
  25757. const PRE_UPDATE_CMD = 'pre-update-cmd';
  25758. const POST_UPDATE_CMD = 'post-update-cmd';
  25759. const PRE_STATUS_CMD = 'pre-status-cmd';
  25760. const POST_STATUS_CMD = 'post-status-cmd';
  25761. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  25762. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  25763. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  25764. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  25765. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  25766. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  25767. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  25768. const POST_PACKAGE_INSTALL = 'post-package-install';
  25769. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  25770. const POST_PACKAGE_UPDATE = 'post-package-update';
  25771. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  25772. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  25773. }
  25774. <?php
  25775. namespace Composer\SelfUpdate;
  25776. class Keys
  25777. {
  25778. public static function fingerprint($path)
  25779. {
  25780. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  25781. return implode(' ', array(
  25782. substr($hash, 0, 8),
  25783. substr($hash, 8, 8),
  25784. substr($hash, 16, 8),
  25785. substr($hash, 24, 8),
  25786. '',
  25787. substr($hash, 32, 8),
  25788. substr($hash, 40, 8),
  25789. substr($hash, 48, 8),
  25790. substr($hash, 56, 8),
  25791. ));
  25792. }
  25793. }
  25794. <?php
  25795. namespace Composer\SelfUpdate;
  25796. use Composer\Util\RemoteFilesystem;
  25797. use Composer\Config;
  25798. use Composer\Json\JsonFile;
  25799. class Versions
  25800. {
  25801. public static $channels = array('stable', 'preview', 'snapshot', '1', '2');
  25802. private $rfs;
  25803. private $config;
  25804. private $channel;
  25805. private $versionsData;
  25806. public function __construct(Config $config, RemoteFilesystem $rfs)
  25807. {
  25808. $this->rfs = $rfs;
  25809. $this->config = $config;
  25810. }
  25811. public function getChannel()
  25812. {
  25813. if ($this->channel) {
  25814. return $this->channel;
  25815. }
  25816. $channelFile = $this->config->get('home').'/update-channel';
  25817. if (file_exists($channelFile)) {
  25818. $channel = trim(file_get_contents($channelFile));
  25819. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  25820. return $this->channel = $channel;
  25821. }
  25822. }
  25823. return $this->channel = 'stable';
  25824. }
  25825. public function setChannel($channel)
  25826. {
  25827. if (!in_array($channel, self::$channels, true)) {
  25828. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
  25829. }
  25830. $channelFile = $this->config->get('home').'/update-channel';
  25831. $this->channel = $channel;
  25832. file_put_contents($channelFile, (is_numeric($channel) ? 'stable' : $channel).PHP_EOL);
  25833. }
  25834. public function getLatest($channel = null)
  25835. {
  25836. $versions = $this->getVersionsData();
  25837. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  25838. if ($version['min-php'] <= PHP_VERSION_ID) {
  25839. return $version;
  25840. }
  25841. }
  25842. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  25843. }
  25844. private function getVersionsData()
  25845. {
  25846. if (!$this->versionsData) {
  25847. if ($this->config->get('disable-tls') === true) {
  25848. $protocol = 'http';
  25849. } else {
  25850. $protocol = 'https';
  25851. }
  25852. $this->versionsData = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  25853. }
  25854. return $this->versionsData;
  25855. }
  25856. }
  25857. <?php
  25858. namespace Composer\Util;
  25859. use Composer\Config;
  25860. use Composer\IO\IOInterface;
  25861. class AuthHelper
  25862. {
  25863. protected $io;
  25864. protected $config;
  25865. public function __construct(IOInterface $io, Config $config)
  25866. {
  25867. $this->io = $io;
  25868. $this->config = $config;
  25869. }
  25870. public function storeAuth($originUrl, $storeAuth)
  25871. {
  25872. $store = false;
  25873. $configSource = $this->config->getAuthConfigSource();
  25874. if ($storeAuth === true) {
  25875. $store = $configSource;
  25876. } elseif ($storeAuth === 'prompt') {
  25877. $answer = $this->io->askAndValidate(
  25878. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  25879. function ($value) {
  25880. $input = strtolower(substr(trim($value), 0, 1));
  25881. if (in_array($input, array('y','n'))) {
  25882. return $input;
  25883. }
  25884. throw new \RuntimeException('Please answer (y)es or (n)o');
  25885. },
  25886. null,
  25887. 'y'
  25888. );
  25889. if ($answer === 'y') {
  25890. $store = $configSource;
  25891. }
  25892. }
  25893. if ($store) {
  25894. $store->addConfigSetting(
  25895. 'http-basic.'.$originUrl,
  25896. $this->io->getAuthentication($originUrl)
  25897. );
  25898. }
  25899. }
  25900. }
  25901. <?php
  25902. namespace Composer\Util;
  25903. use Composer\Factory;
  25904. use Composer\IO\IOInterface;
  25905. use Composer\Config;
  25906. use Composer\Downloader\TransportException;
  25907. class Bitbucket
  25908. {
  25909. private $io;
  25910. private $config;
  25911. private $process;
  25912. private $remoteFilesystem;
  25913. private $token = array();
  25914. private $time;
  25915. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  25916. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  25917. {
  25918. $this->io = $io;
  25919. $this->config = $config;
  25920. $this->process = $process ?: new ProcessExecutor($io);
  25921. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25922. $this->time = $time;
  25923. }
  25924. public function getToken()
  25925. {
  25926. if (!isset($this->token['access_token'])) {
  25927. return '';
  25928. }
  25929. return $this->token['access_token'];
  25930. }
  25931. public function authorizeOAuth($originUrl)
  25932. {
  25933. if ($originUrl !== 'bitbucket.org') {
  25934. return false;
  25935. }
  25936. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  25937. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  25938. return true;
  25939. }
  25940. return false;
  25941. }
  25942. private function requestAccessToken($originUrl)
  25943. {
  25944. try {
  25945. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  25946. 'retry-auth-failure' => false,
  25947. 'http' => array(
  25948. 'method' => 'POST',
  25949. 'content' => 'grant_type=client_credentials',
  25950. ),
  25951. ));
  25952. $this->token = json_decode($json, true);
  25953. } catch (TransportException $e) {
  25954. if ($e->getCode() === 400) {
  25955. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25956. $this->io->writeError('This can have two reasons:');
  25957. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  25958. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  25959. return false;
  25960. } elseif (in_array($e->getCode(), array(403, 401))) {
  25961. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25962. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25963. return false;
  25964. }
  25965. throw $e;
  25966. }
  25967. return true;
  25968. }
  25969. public function authorizeOAuthInteractively($originUrl, $message = null)
  25970. {
  25971. if ($message) {
  25972. $this->io->writeError($message);
  25973. }
  25974. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  25975. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  25976. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25977. $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)');
  25978. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  25979. if (!$consumerKey) {
  25980. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  25981. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25982. return false;
  25983. }
  25984. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  25985. if (!$consumerSecret) {
  25986. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  25987. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25988. return false;
  25989. }
  25990. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25991. if (!$this->requestAccessToken($originUrl)) {
  25992. return false;
  25993. }
  25994. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25995. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  25996. $this->io->writeError('<info>Consumer stored successfully.</info>');
  25997. return true;
  25998. }
  25999. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  26000. {
  26001. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  26002. return $this->token['access_token'];
  26003. }
  26004. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  26005. if (!$this->requestAccessToken($originUrl)) {
  26006. return '';
  26007. }
  26008. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  26009. return $this->token['access_token'];
  26010. }
  26011. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  26012. {
  26013. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  26014. $time = null === $this->time ? time() : $this->time;
  26015. $consumer = array(
  26016. "consumer-key" => $consumerKey,
  26017. "consumer-secret" => $consumerSecret,
  26018. "access-token" => $this->token['access_token'],
  26019. "access-token-expiration" => $time + $this->token['expires_in'],
  26020. );
  26021. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  26022. }
  26023. private function getTokenFromConfig($originUrl)
  26024. {
  26025. $authConfig = $this->config->get('bitbucket-oauth');
  26026. if (
  26027. !isset($authConfig[$originUrl]['access-token'])
  26028. || !isset($authConfig[$originUrl]['access-token-expiration'])
  26029. || time() > $authConfig[$originUrl]['access-token-expiration']
  26030. ) {
  26031. return false;
  26032. }
  26033. $this->token = array(
  26034. 'access_token' => $authConfig[$originUrl]['access-token'],
  26035. );
  26036. return true;
  26037. }
  26038. }
  26039. <?php
  26040. namespace Composer\Util;
  26041. class ComposerMirror
  26042. {
  26043. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  26044. {
  26045. if ($reference) {
  26046. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  26047. }
  26048. $version = strpos($version, '/') === false ? $version : md5($version);
  26049. return str_replace(
  26050. array('%package%', '%version%', '%reference%', '%type%'),
  26051. array($packageName, $version, $reference, $type),
  26052. $mirrorUrl
  26053. );
  26054. }
  26055. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  26056. {
  26057. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  26058. $url = 'gh-'.$match[1].'/'.$match[2];
  26059. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  26060. $url = 'bb-'.$match[1].'/'.$match[2];
  26061. } else {
  26062. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  26063. }
  26064. return str_replace(
  26065. array('%package%', '%normalizedUrl%', '%type%'),
  26066. array($packageName, $url, $type),
  26067. $mirrorUrl
  26068. );
  26069. }
  26070. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  26071. {
  26072. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  26073. }
  26074. }
  26075. <?php
  26076. namespace Composer\Util;
  26077. use Composer\Package\Loader\ArrayLoader;
  26078. use Composer\Package\Loader\ValidatingArrayLoader;
  26079. use Composer\Package\Loader\InvalidPackageException;
  26080. use Composer\Json\JsonValidationException;
  26081. use Composer\IO\IOInterface;
  26082. use Composer\Json\JsonFile;
  26083. use Composer\Spdx\SpdxLicenses;
  26084. class ConfigValidator
  26085. {
  26086. private $io;
  26087. public function __construct(IOInterface $io)
  26088. {
  26089. $this->io = $io;
  26090. }
  26091. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  26092. {
  26093. $errors = array();
  26094. $publishErrors = array();
  26095. $warnings = array();
  26096. $laxValid = false;
  26097. try {
  26098. $json = new JsonFile($file, null, $this->io);
  26099. $manifest = $json->read();
  26100. $json->validateSchema(JsonFile::LAX_SCHEMA);
  26101. $laxValid = true;
  26102. $json->validateSchema();
  26103. } catch (JsonValidationException $e) {
  26104. foreach ($e->getErrors() as $message) {
  26105. if ($laxValid) {
  26106. $publishErrors[] = $message;
  26107. } else {
  26108. $errors[] = $message;
  26109. }
  26110. }
  26111. } catch (\Exception $e) {
  26112. $errors[] = $e->getMessage();
  26113. return array($errors, $publishErrors, $warnings);
  26114. }
  26115. if (empty($manifest['license'])) {
  26116. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  26117. } else {
  26118. $licenses = (array) $manifest['license'];
  26119. foreach ($licenses as $key => $license) {
  26120. if ('proprietary' === $license) {
  26121. unset($licenses[$key]);
  26122. }
  26123. }
  26124. $licenseValidator = new SpdxLicenses();
  26125. foreach ($licenses as $license) {
  26126. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  26127. if ($spdxLicense && $spdxLicense[3]) {
  26128. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  26129. $warnings[] = sprintf(
  26130. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  26131. $license
  26132. );
  26133. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  26134. $warnings[] = sprintf(
  26135. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  26136. $license
  26137. );
  26138. } else {
  26139. $warnings[] = sprintf(
  26140. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  26141. $license
  26142. );
  26143. }
  26144. }
  26145. }
  26146. }
  26147. if (isset($manifest['version'])) {
  26148. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  26149. }
  26150. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  26151. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  26152. $suggestName = strtolower($suggestName);
  26153. $publishErrors[] = sprintf(
  26154. '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.',
  26155. $manifest['name'],
  26156. $suggestName
  26157. );
  26158. }
  26159. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  26160. $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.";
  26161. }
  26162. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  26163. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  26164. if (!empty($requireOverrides)) {
  26165. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  26166. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  26167. }
  26168. }
  26169. $require = isset($manifest['require']) ? $manifest['require'] : array();
  26170. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  26171. $packages = array_merge($require, $requireDev);
  26172. foreach ($packages as $package => $version) {
  26173. if (preg_match('/#/', $version) === 1) {
  26174. $warnings[] = sprintf(
  26175. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  26176. $package
  26177. );
  26178. }
  26179. }
  26180. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  26181. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  26182. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  26183. if (!array_key_exists($scriptName, $scripts)) {
  26184. $warnings[] = sprintf(
  26185. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  26186. $scriptName
  26187. );
  26188. }
  26189. }
  26190. if (isset($manifest['autoload']['psr-0'][''])) {
  26191. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  26192. }
  26193. if (isset($manifest['autoload']['psr-4'][''])) {
  26194. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  26195. }
  26196. try {
  26197. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  26198. if (!isset($manifest['version'])) {
  26199. $manifest['version'] = '1.0.0';
  26200. }
  26201. if (!isset($manifest['name'])) {
  26202. $manifest['name'] = 'dummy/dummy';
  26203. }
  26204. $loader->load($manifest);
  26205. } catch (InvalidPackageException $e) {
  26206. $errors = array_merge($errors, $e->getErrors());
  26207. }
  26208. $warnings = array_merge($warnings, $loader->getWarnings());
  26209. return array($errors, $publishErrors, $warnings);
  26210. }
  26211. }
  26212. <?php
  26213. namespace Composer\Util;
  26214. use Composer\IO\IOInterface;
  26215. class ErrorHandler
  26216. {
  26217. private static $io;
  26218. public static function handle($level, $message, $file, $line)
  26219. {
  26220. if (!(error_reporting() & $level)) {
  26221. return;
  26222. }
  26223. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  26224. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  26225. "\na legitimately suppressed error that you were not supposed to see.";
  26226. }
  26227. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  26228. throw new \ErrorException($message, 0, $level, $file, $line);
  26229. }
  26230. if (self::$io) {
  26231. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  26232. if (self::$io->isVerbose()) {
  26233. self::$io->writeError('<warning>Stack trace:</warning>');
  26234. self::$io->writeError(array_filter(array_map(function ($a) {
  26235. if (isset($a['line'], $a['file'])) {
  26236. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  26237. }
  26238. return null;
  26239. }, array_slice(debug_backtrace(), 2))));
  26240. }
  26241. }
  26242. return true;
  26243. }
  26244. public static function register(IOInterface $io = null)
  26245. {
  26246. set_error_handler(array(__CLASS__, 'handle'));
  26247. error_reporting(E_ALL | E_STRICT);
  26248. self::$io = $io;
  26249. }
  26250. }
  26251. <?php
  26252. namespace Composer\Util;
  26253. use RecursiveDirectoryIterator;
  26254. use RecursiveIteratorIterator;
  26255. use Symfony\Component\Filesystem\Exception\IOException;
  26256. use Symfony\Component\Finder\Finder;
  26257. class Filesystem
  26258. {
  26259. private $processExecutor;
  26260. public function __construct(ProcessExecutor $executor = null)
  26261. {
  26262. $this->processExecutor = $executor ?: new ProcessExecutor();
  26263. }
  26264. public function remove($file)
  26265. {
  26266. if (is_dir($file)) {
  26267. return $this->removeDirectory($file);
  26268. }
  26269. if (file_exists($file)) {
  26270. return $this->unlink($file);
  26271. }
  26272. return false;
  26273. }
  26274. public function isDirEmpty($dir)
  26275. {
  26276. $finder = Finder::create()
  26277. ->ignoreVCS(false)
  26278. ->ignoreDotFiles(false)
  26279. ->depth(0)
  26280. ->in($dir);
  26281. return count($finder) === 0;
  26282. }
  26283. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  26284. {
  26285. if (file_exists($dir) && is_link($dir)) {
  26286. $this->unlink($dir);
  26287. }
  26288. if ($ensureDirectoryExists) {
  26289. $this->ensureDirectoryExists($dir);
  26290. }
  26291. if (is_dir($dir)) {
  26292. $finder = Finder::create()
  26293. ->ignoreVCS(false)
  26294. ->ignoreDotFiles(false)
  26295. ->depth(0)
  26296. ->in($dir);
  26297. foreach ($finder as $path) {
  26298. $this->remove((string) $path);
  26299. }
  26300. }
  26301. }
  26302. public function removeDirectory($directory)
  26303. {
  26304. if ($this->isSymlinkedDirectory($directory)) {
  26305. return $this->unlinkSymlinkedDirectory($directory);
  26306. }
  26307. if ($this->isJunction($directory)) {
  26308. return $this->removeJunction($directory);
  26309. }
  26310. if (is_link($directory)) {
  26311. return unlink($directory);
  26312. }
  26313. if (!file_exists($directory) || !is_dir($directory)) {
  26314. return true;
  26315. }
  26316. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  26317. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  26318. }
  26319. if (!function_exists('proc_open')) {
  26320. return $this->removeDirectoryPhp($directory);
  26321. }
  26322. if (Platform::isWindows()) {
  26323. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  26324. } else {
  26325. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  26326. }
  26327. $result = $this->getProcess()->execute($cmd, $output) === 0;
  26328. clearstatcache();
  26329. if ($result && !file_exists($directory)) {
  26330. return true;
  26331. }
  26332. return $this->removeDirectoryPhp($directory);
  26333. }
  26334. public function removeDirectoryPhp($directory)
  26335. {
  26336. try {
  26337. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26338. } catch (\UnexpectedValueException $e) {
  26339. clearstatcache();
  26340. usleep(100000);
  26341. if (!is_dir($directory)) {
  26342. return true;
  26343. }
  26344. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26345. }
  26346. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26347. foreach ($ri as $file) {
  26348. if ($file->isDir()) {
  26349. $this->rmdir($file->getPathname());
  26350. } else {
  26351. $this->unlink($file->getPathname());
  26352. }
  26353. }
  26354. return $this->rmdir($directory);
  26355. }
  26356. public function ensureDirectoryExists($directory)
  26357. {
  26358. if (!is_dir($directory)) {
  26359. if (file_exists($directory)) {
  26360. throw new \RuntimeException(
  26361. $directory.' exists and is not a directory.'
  26362. );
  26363. }
  26364. if (!@mkdir($directory, 0777, true)) {
  26365. throw new \RuntimeException(
  26366. $directory.' does not exist and could not be created.'
  26367. );
  26368. }
  26369. }
  26370. }
  26371. public function unlink($path)
  26372. {
  26373. $unlinked = @$this->unlinkImplementation($path);
  26374. if (!$unlinked) {
  26375. if (Platform::isWindows()) {
  26376. usleep(350000);
  26377. $unlinked = @$this->unlinkImplementation($path);
  26378. }
  26379. if (!$unlinked) {
  26380. $error = error_get_last();
  26381. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26382. if (Platform::isWindows()) {
  26383. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26384. }
  26385. throw new \RuntimeException($message);
  26386. }
  26387. }
  26388. return true;
  26389. }
  26390. public function rmdir($path)
  26391. {
  26392. $deleted = @rmdir($path);
  26393. if (!$deleted) {
  26394. if (Platform::isWindows()) {
  26395. usleep(350000);
  26396. $deleted = @rmdir($path);
  26397. }
  26398. if (!$deleted) {
  26399. $error = error_get_last();
  26400. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26401. if (Platform::isWindows()) {
  26402. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26403. }
  26404. throw new \RuntimeException($message);
  26405. }
  26406. }
  26407. return true;
  26408. }
  26409. public function copyThenRemove($source, $target)
  26410. {
  26411. $this->copy($source, $target);
  26412. if (!is_dir($source)) {
  26413. $this->unlink($source);
  26414. return;
  26415. }
  26416. $this->removeDirectoryPhp($source);
  26417. }
  26418. public function copy($source, $target)
  26419. {
  26420. if (!is_dir($source)) {
  26421. return copy($source, $target);
  26422. }
  26423. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  26424. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  26425. $this->ensureDirectoryExists($target);
  26426. $result = true;
  26427. foreach ($ri as $file) {
  26428. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  26429. if ($file->isDir()) {
  26430. $this->ensureDirectoryExists($targetPath);
  26431. } else {
  26432. $result = $result && copy($file->getPathname(), $targetPath);
  26433. }
  26434. }
  26435. return $result;
  26436. }
  26437. public function rename($source, $target)
  26438. {
  26439. if (true === @rename($source, $target)) {
  26440. return;
  26441. }
  26442. if (!function_exists('proc_open')) {
  26443. $this->copyThenRemove($source, $target);
  26444. return;
  26445. }
  26446. if (Platform::isWindows()) {
  26447. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26448. $result = $this->processExecutor->execute($command, $output);
  26449. clearstatcache();
  26450. if (0 === $result) {
  26451. $this->remove($source);
  26452. return;
  26453. }
  26454. } else {
  26455. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26456. $result = $this->processExecutor->execute($command, $output);
  26457. clearstatcache();
  26458. if (0 === $result) {
  26459. return;
  26460. }
  26461. }
  26462. $this->copyThenRemove($source, $target);
  26463. }
  26464. public function findShortestPath($from, $to, $directories = false)
  26465. {
  26466. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26467. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26468. }
  26469. $from = lcfirst($this->normalizePath($from));
  26470. $to = lcfirst($this->normalizePath($to));
  26471. if ($directories) {
  26472. $from = rtrim($from, '/') . '/dummy_file';
  26473. }
  26474. if (dirname($from) === dirname($to)) {
  26475. return './'.basename($to);
  26476. }
  26477. $commonPath = $to;
  26478. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  26479. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26480. }
  26481. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  26482. return $to;
  26483. }
  26484. $commonPath = rtrim($commonPath, '/') . '/';
  26485. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  26486. $commonPathCode = str_repeat('../', $sourcePathDepth);
  26487. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  26488. }
  26489. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  26490. {
  26491. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26492. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26493. }
  26494. $from = lcfirst($this->normalizePath($from));
  26495. $to = lcfirst($this->normalizePath($to));
  26496. if ($from === $to) {
  26497. return $directories ? '__DIR__' : '__FILE__';
  26498. }
  26499. $commonPath = $to;
  26500. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  26501. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26502. }
  26503. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  26504. return var_export($to, true);
  26505. }
  26506. $commonPath = rtrim($commonPath, '/') . '/';
  26507. if (strpos($to, $from.'/') === 0) {
  26508. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  26509. }
  26510. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  26511. if ($staticCode) {
  26512. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  26513. } else {
  26514. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  26515. }
  26516. $relTarget = substr($to, strlen($commonPath));
  26517. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  26518. }
  26519. public function isAbsolutePath($path)
  26520. {
  26521. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  26522. }
  26523. public function size($path)
  26524. {
  26525. if (!file_exists($path)) {
  26526. throw new \RuntimeException("$path does not exist.");
  26527. }
  26528. if (is_dir($path)) {
  26529. return $this->directorySize($path);
  26530. }
  26531. return filesize($path);
  26532. }
  26533. public function normalizePath($path)
  26534. {
  26535. $parts = array();
  26536. $path = strtr($path, '\\', '/');
  26537. $prefix = '';
  26538. $absolute = false;
  26539. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  26540. $prefix = $match[1];
  26541. $path = substr($path, strlen($prefix));
  26542. }
  26543. if (substr($path, 0, 1) === '/') {
  26544. $absolute = true;
  26545. $path = substr($path, 1);
  26546. }
  26547. $up = false;
  26548. foreach (explode('/', $path) as $chunk) {
  26549. if ('..' === $chunk && ($absolute || $up)) {
  26550. array_pop($parts);
  26551. $up = !(empty($parts) || '..' === end($parts));
  26552. } elseif ('.' !== $chunk && '' !== $chunk) {
  26553. $parts[] = $chunk;
  26554. $up = '..' !== $chunk;
  26555. }
  26556. }
  26557. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  26558. }
  26559. public static function isLocalPath($path)
  26560. {
  26561. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  26562. }
  26563. public static function getPlatformPath($path)
  26564. {
  26565. if (Platform::isWindows()) {
  26566. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  26567. }
  26568. return preg_replace('{^file://}i', '', $path);
  26569. }
  26570. protected function directorySize($directory)
  26571. {
  26572. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26573. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26574. $size = 0;
  26575. foreach ($ri as $file) {
  26576. if ($file->isFile()) {
  26577. $size += $file->getSize();
  26578. }
  26579. }
  26580. return $size;
  26581. }
  26582. protected function getProcess()
  26583. {
  26584. return $this->processExecutor;
  26585. }
  26586. private function unlinkImplementation($path)
  26587. {
  26588. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  26589. return rmdir($path);
  26590. }
  26591. return unlink($path);
  26592. }
  26593. public function relativeSymlink($target, $link)
  26594. {
  26595. $cwd = getcwd();
  26596. $relativePath = $this->findShortestPath($link, $target);
  26597. chdir(dirname($link));
  26598. $result = @symlink($relativePath, $link);
  26599. chdir($cwd);
  26600. return $result;
  26601. }
  26602. public function isSymlinkedDirectory($directory)
  26603. {
  26604. if (!is_dir($directory)) {
  26605. return false;
  26606. }
  26607. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26608. return is_link($resolved);
  26609. }
  26610. private function unlinkSymlinkedDirectory($directory)
  26611. {
  26612. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26613. return $this->unlink($resolved);
  26614. }
  26615. private function resolveSymlinkedDirectorySymlink($pathname)
  26616. {
  26617. if (!is_dir($pathname)) {
  26618. return $pathname;
  26619. }
  26620. $resolved = rtrim($pathname, '/');
  26621. if (!strlen($resolved)) {
  26622. return $pathname;
  26623. }
  26624. return $resolved;
  26625. }
  26626. public function junction($target, $junction)
  26627. {
  26628. if (!Platform::isWindows()) {
  26629. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  26630. }
  26631. if (!is_dir($target)) {
  26632. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  26633. }
  26634. $cmd = sprintf(
  26635. 'mklink /J %s %s',
  26636. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  26637. ProcessExecutor::escape(realpath($target))
  26638. );
  26639. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  26640. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  26641. }
  26642. clearstatcache(true, $junction);
  26643. }
  26644. public function isJunction($junction)
  26645. {
  26646. if (!Platform::isWindows()) {
  26647. return false;
  26648. }
  26649. clearstatcache(true, $junction);
  26650. if (!is_dir($junction) || is_link($junction)) {
  26651. return false;
  26652. }
  26653. $stat = lstat($junction);
  26654. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  26655. }
  26656. public function removeJunction($junction)
  26657. {
  26658. if (!Platform::isWindows()) {
  26659. return false;
  26660. }
  26661. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  26662. if (!$this->isJunction($junction)) {
  26663. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  26664. }
  26665. return $this->rmdir($junction);
  26666. }
  26667. }
  26668. <?php
  26669. namespace Composer\Util;
  26670. use Composer\Config;
  26671. use Composer\IO\IOInterface;
  26672. class Git
  26673. {
  26674. private static $version = false;
  26675. protected $io;
  26676. protected $config;
  26677. protected $process;
  26678. protected $filesystem;
  26679. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  26680. {
  26681. $this->io = $io;
  26682. $this->config = $config;
  26683. $this->process = $process;
  26684. $this->filesystem = $fs;
  26685. }
  26686. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  26687. {
  26688. $this->config->prohibitUrlByConfig($url, $this->io);
  26689. if ($initialClone) {
  26690. $origCwd = $cwd;
  26691. $cwd = null;
  26692. }
  26693. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  26694. 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.');
  26695. }
  26696. if (!$initialClone) {
  26697. $this->process->execute('git remote -v', $output, $cwd);
  26698. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  26699. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  26700. }
  26701. }
  26702. $protocols = $this->config->get('github-protocols');
  26703. if (!is_array($protocols)) {
  26704. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  26705. }
  26706. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  26707. $messages = array();
  26708. foreach ($protocols as $protocol) {
  26709. if ('ssh' === $protocol) {
  26710. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  26711. } else {
  26712. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  26713. }
  26714. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  26715. return;
  26716. }
  26717. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  26718. if ($initialClone) {
  26719. $this->filesystem->removeDirectory($origCwd);
  26720. }
  26721. }
  26722. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  26723. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  26724. }
  26725. }
  26726. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  26727. $command = call_user_func($commandCallable, $url);
  26728. $auth = null;
  26729. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  26730. $errorMsg = $this->process->getErrorOutput();
  26731. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  26732. || preg_match('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26733. ) {
  26734. if (!$this->io->hasAuthentication($match[1])) {
  26735. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  26736. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  26737. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26738. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  26739. }
  26740. }
  26741. if ($this->io->hasAuthentication($match[1])) {
  26742. $auth = $this->io->getAuthentication($match[1]);
  26743. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26744. $command = call_user_func($commandCallable, $authUrl);
  26745. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26746. return;
  26747. }
  26748. $errorMsg = $this->process->getErrorOutput();
  26749. }
  26750. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  26751. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  26752. if (!$this->io->hasAuthentication($match[1])) {
  26753. $message = 'Enter your Bitbucket credentials to access private repos';
  26754. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26755. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  26756. $accessToken = $bitbucketUtil->getToken();
  26757. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26758. }
  26759. } else {
  26760. $auth = $this->io->getAuthentication($match[1]);
  26761. if ($auth['username'] !== 'x-token-auth') {
  26762. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  26763. if (! empty($accessToken)) {
  26764. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26765. }
  26766. }
  26767. }
  26768. if ($this->io->hasAuthentication($match[1])) {
  26769. $auth = $this->io->getAuthentication($match[1]);
  26770. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26771. $command = call_user_func($commandCallable, $authUrl);
  26772. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26773. return;
  26774. }
  26775. $errorMsg = $this->process->getErrorOutput();
  26776. } else {
  26777. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  26778. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  26779. $command = call_user_func($commandCallable, $sshUrl);
  26780. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26781. return;
  26782. }
  26783. $errorMsg = $this->process->getErrorOutput();
  26784. }
  26785. } elseif (
  26786. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  26787. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26788. ) {
  26789. if ($match[1] === 'git') {
  26790. $match[1] = 'https';
  26791. }
  26792. if (!$this->io->hasAuthentication($match[2])) {
  26793. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  26794. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  26795. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  26796. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  26797. }
  26798. }
  26799. if ($this->io->hasAuthentication($match[2])) {
  26800. $auth = $this->io->getAuthentication($match[2]);
  26801. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  26802. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  26803. } else {
  26804. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  26805. }
  26806. $command = call_user_func($commandCallable, $authUrl);
  26807. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26808. return;
  26809. }
  26810. $errorMsg = $this->process->getErrorOutput();
  26811. }
  26812. } elseif ($this->isAuthenticationFailure($url, $match)) {
  26813. if (strpos($match[2], '@')) {
  26814. list($authParts, $match[2]) = explode('@', $match[2], 2);
  26815. }
  26816. $storeAuth = false;
  26817. if ($this->io->hasAuthentication($match[2])) {
  26818. $auth = $this->io->getAuthentication($match[2]);
  26819. } elseif ($this->io->isInteractive()) {
  26820. $defaultUsername = null;
  26821. if (isset($authParts) && $authParts) {
  26822. if (false !== strpos($authParts, ':')) {
  26823. list($defaultUsername, ) = explode(':', $authParts, 2);
  26824. } else {
  26825. $defaultUsername = $authParts;
  26826. }
  26827. }
  26828. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  26829. $auth = array(
  26830. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  26831. 'password' => $this->io->askAndHideAnswer(' Password: '),
  26832. );
  26833. $storeAuth = $this->config->get('store-auths');
  26834. }
  26835. if ($auth) {
  26836. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  26837. $command = call_user_func($commandCallable, $authUrl);
  26838. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26839. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  26840. $authHelper = new AuthHelper($this->io, $this->config);
  26841. $authHelper->storeAuth($match[2], $storeAuth);
  26842. return;
  26843. }
  26844. $errorMsg = $this->process->getErrorOutput();
  26845. }
  26846. }
  26847. if ($initialClone) {
  26848. $this->filesystem->removeDirectory($origCwd);
  26849. }
  26850. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  26851. }
  26852. }
  26853. public function syncMirror($url, $dir)
  26854. {
  26855. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26856. try {
  26857. $commandCallable = function ($url) {
  26858. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  26859. return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  26860. };
  26861. $this->runCommand($commandCallable, $url, $dir);
  26862. } catch (\Exception $e) {
  26863. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  26864. return false;
  26865. }
  26866. return true;
  26867. }
  26868. $this->filesystem->removeDirectory($dir);
  26869. $commandCallable = function ($url) use ($dir) {
  26870. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  26871. };
  26872. $this->runCommand($commandCallable, $url, $dir, true);
  26873. return true;
  26874. }
  26875. public function fetchRefOrSyncMirror($url, $dir, $ref)
  26876. {
  26877. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  26878. return true;
  26879. }
  26880. if ($this->syncMirror($url, $dir)) {
  26881. return $this->checkRefIsInMirror($url, $dir, $ref);
  26882. }
  26883. return false;
  26884. }
  26885. public static function getNoShowSignatureFlag(ProcessExecutor $process)
  26886. {
  26887. $gitVersion = self::getVersion($process);
  26888. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  26889. return ' --no-show-signature';
  26890. }
  26891. return '';
  26892. }
  26893. private function checkRefIsInMirror($url, $dir, $ref)
  26894. {
  26895. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26896. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  26897. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  26898. if ($exitCode === 0) {
  26899. return true;
  26900. }
  26901. }
  26902. return false;
  26903. }
  26904. private function isAuthenticationFailure($url, &$match)
  26905. {
  26906. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  26907. return false;
  26908. }
  26909. $authFailures = array(
  26910. 'fatal: Authentication failed',
  26911. 'remote error: Invalid username or password.',
  26912. 'error: 401 Unauthorized',
  26913. 'fatal: unable to access',
  26914. 'fatal: could not read Username',
  26915. );
  26916. $errorOutput = $this->process->getErrorOutput();
  26917. foreach ($authFailures as $authFailure) {
  26918. if (strpos($errorOutput, $authFailure) !== false) {
  26919. return true;
  26920. }
  26921. }
  26922. return false;
  26923. }
  26924. public static function cleanEnv()
  26925. {
  26926. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  26927. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  26928. }
  26929. if (getenv('GIT_ASKPASS') !== 'echo') {
  26930. putenv('GIT_ASKPASS=echo');
  26931. unset($_SERVER['GIT_ASKPASS']);
  26932. }
  26933. if (getenv('GIT_DIR')) {
  26934. putenv('GIT_DIR');
  26935. unset($_SERVER['GIT_DIR']);
  26936. }
  26937. if (getenv('GIT_WORK_TREE')) {
  26938. putenv('GIT_WORK_TREE');
  26939. unset($_SERVER['GIT_WORK_TREE']);
  26940. }
  26941. if (getenv('LANGUAGE') !== 'C') {
  26942. putenv('LANGUAGE=C');
  26943. }
  26944. putenv("DYLD_LIBRARY_PATH");
  26945. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26946. }
  26947. public static function getGitHubDomainsRegex(Config $config)
  26948. {
  26949. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  26950. }
  26951. public static function getGitLabDomainsRegex(Config $config)
  26952. {
  26953. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  26954. }
  26955. public static function sanitizeUrl($message)
  26956. {
  26957. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26958. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26959. return '://***:***@';
  26960. }
  26961. return '://' . $m[1] . ':***@';
  26962. }, $message);
  26963. }
  26964. private function throwException($message, $url)
  26965. {
  26966. clearstatcache();
  26967. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  26968. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  26969. }
  26970. throw new \RuntimeException(self::sanitizeUrl($message));
  26971. }
  26972. public static function getVersion(ProcessExecutor $process = null)
  26973. {
  26974. if (false === self::$version) {
  26975. self::$version = null;
  26976. if (!$process) {
  26977. $process = new ProcessExecutor;
  26978. }
  26979. if (0 === $process->execute('git --version', $output) && preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  26980. self::$version = $matches[1];
  26981. }
  26982. }
  26983. return self::$version;
  26984. }
  26985. }
  26986. <?php
  26987. namespace Composer\Util;
  26988. use Composer\Factory;
  26989. use Composer\IO\IOInterface;
  26990. use Composer\Config;
  26991. use Composer\Downloader\TransportException;
  26992. class GitHub
  26993. {
  26994. protected $io;
  26995. protected $config;
  26996. protected $process;
  26997. protected $remoteFilesystem;
  26998. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26999. {
  27000. $this->io = $io;
  27001. $this->config = $config;
  27002. $this->process = $process ?: new ProcessExecutor($io);
  27003. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27004. }
  27005. public function authorizeOAuth($originUrl)
  27006. {
  27007. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  27008. return false;
  27009. }
  27010. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  27011. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  27012. return true;
  27013. }
  27014. return false;
  27015. }
  27016. public function authorizeOAuthInteractively($originUrl, $message = null)
  27017. {
  27018. if ($message) {
  27019. $this->io->writeError($message);
  27020. }
  27021. $note = 'Composer';
  27022. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  27023. $note .= ' on ' . trim($output);
  27024. }
  27025. $note .= ' ' . date('Y-m-d Hi');
  27026. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  27027. $this->io->writeError(sprintf('Head to %s', $url));
  27028. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  27029. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  27030. if (!$token) {
  27031. $this->io->writeError('<warning>No token given, aborting.</warning>');
  27032. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27033. return false;
  27034. }
  27035. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  27036. try {
  27037. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  27038. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  27039. 'retry-auth-failure' => false,
  27040. ));
  27041. } catch (TransportException $e) {
  27042. if (in_array($e->getCode(), array(403, 401))) {
  27043. $this->io->writeError('<error>Invalid token provided.</error>');
  27044. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27045. return false;
  27046. }
  27047. throw $e;
  27048. }
  27049. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  27050. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  27051. $this->io->writeError('<info>Token stored successfully.</info>');
  27052. return true;
  27053. }
  27054. public function getRateLimit(array $headers)
  27055. {
  27056. $rateLimit = array(
  27057. 'limit' => '?',
  27058. 'reset' => '?',
  27059. );
  27060. foreach ($headers as $header) {
  27061. $header = trim($header);
  27062. if (false === strpos($header, 'X-RateLimit-')) {
  27063. continue;
  27064. }
  27065. list($type, $value) = explode(':', $header, 2);
  27066. switch ($type) {
  27067. case 'X-RateLimit-Limit':
  27068. $rateLimit['limit'] = (int) trim($value);
  27069. break;
  27070. case 'X-RateLimit-Reset':
  27071. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  27072. break;
  27073. }
  27074. }
  27075. return $rateLimit;
  27076. }
  27077. public function isRateLimited(array $headers)
  27078. {
  27079. foreach ($headers as $header) {
  27080. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  27081. return true;
  27082. }
  27083. }
  27084. return false;
  27085. }
  27086. }
  27087. <?php
  27088. namespace Composer\Util;
  27089. use Composer\IO\IOInterface;
  27090. use Composer\Config;
  27091. use Composer\Factory;
  27092. use Composer\Downloader\TransportException;
  27093. use Composer\Json\JsonFile;
  27094. class GitLab
  27095. {
  27096. protected $io;
  27097. protected $config;
  27098. protected $process;
  27099. protected $remoteFilesystem;
  27100. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  27101. {
  27102. $this->io = $io;
  27103. $this->config = $config;
  27104. $this->process = $process ?: new ProcessExecutor($io);
  27105. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27106. }
  27107. public function authorizeOAuth($originUrl)
  27108. {
  27109. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  27110. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  27111. return false;
  27112. }
  27113. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  27114. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  27115. return true;
  27116. }
  27117. $authTokens = $this->config->get('gitlab-token');
  27118. if (isset($authTokens[$originUrl])) {
  27119. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  27120. return true;
  27121. }
  27122. if (isset($authTokens[$bcOriginUrl])) {
  27123. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  27124. return true;
  27125. }
  27126. return false;
  27127. }
  27128. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  27129. {
  27130. if ($message) {
  27131. $this->io->writeError($message);
  27132. }
  27133. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  27134. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/profile/applications');
  27135. $attemptCounter = 0;
  27136. while ($attemptCounter++ < 5) {
  27137. try {
  27138. $response = $this->createToken($scheme, $originUrl);
  27139. } catch (TransportException $e) {
  27140. if (in_array($e->getCode(), array(403, 401))) {
  27141. if (401 === $e->getCode()) {
  27142. $response = json_decode($e->getResponse(), true);
  27143. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  27144. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  27145. } else {
  27146. $this->io->writeError('Bad credentials.');
  27147. }
  27148. } else {
  27149. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  27150. }
  27151. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  27152. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  27153. continue;
  27154. }
  27155. throw $e;
  27156. }
  27157. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  27158. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  27159. return true;
  27160. }
  27161. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  27162. }
  27163. private function createToken($scheme, $originUrl)
  27164. {
  27165. $username = $this->io->ask('Username: ');
  27166. $password = $this->io->askAndHideAnswer('Password: ');
  27167. $headers = array('Content-Type: application/x-www-form-urlencoded');
  27168. $apiUrl = $originUrl;
  27169. $data = http_build_query(array(
  27170. 'username' => $username,
  27171. 'password' => $password,
  27172. 'grant_type' => 'password',
  27173. ), null, '&');
  27174. $options = array(
  27175. 'retry-auth-failure' => false,
  27176. 'http' => array(
  27177. 'method' => 'POST',
  27178. 'header' => $headers,
  27179. 'content' => $data,
  27180. ),
  27181. );
  27182. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  27183. $this->io->writeError('Token successfully created');
  27184. return JsonFile::parseJson($json);
  27185. }
  27186. }
  27187. <?php
  27188. namespace Composer\Util;
  27189. use Composer\Config;
  27190. use Composer\IO\IOInterface;
  27191. class Hg
  27192. {
  27193. private $io;
  27194. private $config;
  27195. private $process;
  27196. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  27197. {
  27198. $this->io = $io;
  27199. $this->config = $config;
  27200. $this->process = $process;
  27201. }
  27202. public function runCommand($commandCallable, $url, $cwd)
  27203. {
  27204. $this->config->prohibitUrlByConfig($url, $this->io);
  27205. $command = call_user_func($commandCallable, $url);
  27206. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27207. return;
  27208. }
  27209. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  27210. $auth = $this->io->getAuthentication($match[5]);
  27211. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  27212. $command = call_user_func($commandCallable, $authenticatedUrl);
  27213. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27214. return;
  27215. }
  27216. $error = $this->process->getErrorOutput();
  27217. } else {
  27218. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  27219. }
  27220. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  27221. }
  27222. public static function sanitizeUrl($message)
  27223. {
  27224. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  27225. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  27226. return '://***:***@';
  27227. }
  27228. return '://' . $m[1] . ':***@';
  27229. }, $message);
  27230. }
  27231. private function throwException($message, $url)
  27232. {
  27233. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  27234. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  27235. }
  27236. throw new \RuntimeException(self::sanitizeUrl($message));
  27237. }
  27238. }
  27239. <?php
  27240. namespace Composer\Util;
  27241. use Composer\XdebugHandler\XdebugHandler;
  27242. class IniHelper
  27243. {
  27244. public static function getAll()
  27245. {
  27246. return XdebugHandler::getAllIniFiles();
  27247. }
  27248. public static function getMessage()
  27249. {
  27250. $paths = self::getAll();
  27251. if (empty($paths[0])) {
  27252. array_shift($paths);
  27253. }
  27254. $ini = array_shift($paths);
  27255. if (empty($ini)) {
  27256. return 'A php.ini file does not exist. You will have to create one.';
  27257. }
  27258. if (!empty($paths)) {
  27259. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  27260. }
  27261. return 'The php.ini used by your command-line PHP is: '.$ini;
  27262. }
  27263. }
  27264. <?php
  27265. namespace Composer\Util;
  27266. use stdClass;
  27267. class NoProxyPattern
  27268. {
  27269. protected $hostNames = array();
  27270. protected $rules = array();
  27271. protected $noproxy;
  27272. public function __construct($pattern)
  27273. {
  27274. $this->hostNames = preg_split('{[\s,]+}', $pattern, null, PREG_SPLIT_NO_EMPTY);
  27275. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  27276. }
  27277. public function test($url)
  27278. {
  27279. if ($this->noproxy) {
  27280. return true;
  27281. }
  27282. if (!$urlData = $this->getUrlData($url)) {
  27283. return false;
  27284. }
  27285. foreach ($this->hostNames as $index => $hostName) {
  27286. if ($this->match($index, $hostName, $urlData)) {
  27287. return true;
  27288. }
  27289. }
  27290. return false;
  27291. }
  27292. protected function getUrlData($url)
  27293. {
  27294. if (!$host = parse_url($url, PHP_URL_HOST)) {
  27295. return false;
  27296. }
  27297. $port = parse_url($url, PHP_URL_PORT);
  27298. if (empty($port)) {
  27299. switch (parse_url($url, PHP_URL_SCHEME)) {
  27300. case 'http':
  27301. $port = 80;
  27302. break;
  27303. case 'https':
  27304. $port = 443;
  27305. break;
  27306. }
  27307. }
  27308. $hostName = $host . ($port ? ':' . $port : '');
  27309. list($host, $port, $err) = $this->splitHostPort($hostName);
  27310. if ($err || !$this->ipCheckData($host, $ipdata)) {
  27311. return false;
  27312. }
  27313. return $this->makeData($host, $port, $ipdata);
  27314. }
  27315. protected function match($index, $hostName, $url)
  27316. {
  27317. if (!$rule = $this->getRule($index, $hostName)) {
  27318. return false;
  27319. }
  27320. if ($rule->ipdata) {
  27321. if (!$url->ipdata) {
  27322. return false;
  27323. }
  27324. if ($rule->ipdata->netmask) {
  27325. return $this->matchRange($rule->ipdata, $url->ipdata);
  27326. }
  27327. $match = $rule->ipdata->ip === $url->ipdata->ip;
  27328. } else {
  27329. $haystack = substr($url->name, - strlen($rule->name));
  27330. $match = stripos($haystack, $rule->name) === 0;
  27331. }
  27332. if ($match && $rule->port) {
  27333. $match = $rule->port === $url->port;
  27334. }
  27335. return $match;
  27336. }
  27337. protected function matchRange(stdClass $network, stdClass $target)
  27338. {
  27339. $net = unpack('C*', $network->ip);
  27340. $mask = unpack('C*', $network->netmask);
  27341. $ip = unpack('C*', $target->ip);
  27342. for ($i = 1; $i < 17; ++$i) {
  27343. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  27344. return false;
  27345. }
  27346. }
  27347. return true;
  27348. }
  27349. private function getRule($index, $hostName)
  27350. {
  27351. if (array_key_exists($index, $this->rules)) {
  27352. return $this->rules[$index];
  27353. }
  27354. $this->rules[$index] = null;
  27355. list($host, $port, $err) = $this->splitHostPort($hostName);
  27356. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  27357. return null;
  27358. }
  27359. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  27360. return $this->rules[$index];
  27361. }
  27362. private function ipCheckData($host, &$ipdata, $allowPrefix = false)
  27363. {
  27364. $ipdata = null;
  27365. $netmask = null;
  27366. $prefix = null;
  27367. $modified = false;
  27368. if (strpos($host, '/') !== false) {
  27369. list($host, $prefix) = explode('/', $host);
  27370. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  27371. return false;
  27372. }
  27373. $prefix = (int) $prefix;
  27374. $modified = true;
  27375. }
  27376. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  27377. return !$modified;
  27378. }
  27379. list($ip, $size) = $this->ipGetAddr($host);
  27380. if ($prefix !== null) {
  27381. if ($prefix > $size * 8) {
  27382. return false;
  27383. }
  27384. list($ip, $netmask) = $this->ipGetNetwork($ip, $size, $prefix);
  27385. }
  27386. $ipdata = $this->makeIpData($ip, $size, $netmask);
  27387. return true;
  27388. }
  27389. private function ipGetAddr($host)
  27390. {
  27391. $ip = inet_pton($host);
  27392. $size = strlen($ip);
  27393. $mapped = $this->ipMapTo6($ip, $size);
  27394. return array($mapped, $size);
  27395. }
  27396. private function ipGetMask($prefix, $size)
  27397. {
  27398. $mask = '';
  27399. if ($ones = floor($prefix / 8)) {
  27400. $mask = str_repeat(chr(255), $ones);
  27401. }
  27402. if ($remainder = $prefix % 8) {
  27403. $mask .= chr(0xff ^ (0xff >> $remainder));
  27404. }
  27405. $mask = str_pad($mask, $size, chr(0));
  27406. return $this->ipMapTo6($mask, $size);
  27407. }
  27408. private function ipGetNetwork($rangeIp, $size, $prefix)
  27409. {
  27410. $netmask = $this->ipGetMask($prefix, $size);
  27411. $mask = unpack('C*', $netmask);
  27412. $ip = unpack('C*', $rangeIp);
  27413. $net = '';
  27414. for ($i = 1; $i < 17; ++$i) {
  27415. $net .= chr($ip[$i] & $mask[$i]);
  27416. }
  27417. return array($net, $netmask);
  27418. }
  27419. private function ipMapTo6($binary, $size)
  27420. {
  27421. if ($size === 4) {
  27422. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  27423. $binary = $prefix . $binary;
  27424. }
  27425. return $binary;
  27426. }
  27427. private function makeData($host, $port, $ipdata)
  27428. {
  27429. return (object) array(
  27430. 'host' => $host,
  27431. 'name' => '.' . ltrim($host, '.'),
  27432. 'port' => $port,
  27433. 'ipdata' => $ipdata,
  27434. );
  27435. }
  27436. private function makeIpData($ip, $size, $netmask)
  27437. {
  27438. return (object) array(
  27439. 'ip' => $ip,
  27440. 'size' => $size,
  27441. 'netmask' => $netmask,
  27442. );
  27443. }
  27444. private function splitHostPort($hostName)
  27445. {
  27446. $error = array('', '', true);
  27447. $port = 0;
  27448. $ip6 = '';
  27449. if ($hostName[0] === '[') {
  27450. $index = strpos($hostName, ']');
  27451. if (false === $index || $index < 3) {
  27452. return $error;
  27453. }
  27454. $ip6 = substr($hostName, 1, $index - 1);
  27455. $hostName = substr($hostName, $index + 1);
  27456. if (strpbrk($hostName, '[]') !== false
  27457. || substr_count($hostName, ':') > 1) {
  27458. return $error;
  27459. }
  27460. }
  27461. if (substr_count($hostName, ':') === 1) {
  27462. $index = strpos($hostName, ':');
  27463. $port = substr($hostName, $index + 1);
  27464. $hostName = substr($hostName, 0, $index);
  27465. if (!$this->validateInt($port, 1, 65535)) {
  27466. return $error;
  27467. }
  27468. $port = (int) $port;
  27469. }
  27470. $host = $ip6 . $hostName;
  27471. return array($host, $port, false);
  27472. }
  27473. private function validateInt($int, $min, $max)
  27474. {
  27475. $options = array(
  27476. 'options' => array(
  27477. 'min_range' => $min,
  27478. 'max_range' => $max)
  27479. );
  27480. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  27481. }
  27482. }
  27483. <?php
  27484. namespace Composer\Util;
  27485. use Composer\Package\Link;
  27486. use Composer\Package\PackageInterface;
  27487. class PackageSorter
  27488. {
  27489. public static function sortPackages(array $packages) {
  27490. $usageList = array();
  27491. foreach ($packages as $package) {
  27492. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  27493. $target = $link->getTarget();
  27494. $usageList[$target][] = $package->getName();
  27495. }
  27496. }
  27497. $computing = array();
  27498. $computed = array();
  27499. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  27500. if (isset($computed[$name])) {
  27501. return $computed[$name];
  27502. }
  27503. if (isset($computing[$name])) {
  27504. return 0;
  27505. }
  27506. $computing[$name] = true;
  27507. $weight = 0;
  27508. if (isset($usageList[$name])) {
  27509. foreach ($usageList[$name] as $user) {
  27510. $weight -= 1 - $computeImportance($user);
  27511. }
  27512. }
  27513. unset($computing[$name]);
  27514. $computed[$name] = $weight;
  27515. return $weight;
  27516. };
  27517. $weightList = array();
  27518. foreach ($packages as $name => $package) {
  27519. $weight = $computeImportance($name);
  27520. $weightList[$name] = $weight;
  27521. }
  27522. $stable_sort = function (&$array) {
  27523. static $transform, $restore;
  27524. $i = 0;
  27525. if (!$transform) {
  27526. $transform = function (&$v, $k) use (&$i) {
  27527. $v = array($v, ++$i, $k, $v);
  27528. };
  27529. $restore = function (&$v) {
  27530. $v = $v[3];
  27531. };
  27532. }
  27533. array_walk($array, $transform);
  27534. asort($array);
  27535. array_walk($array, $restore);
  27536. };
  27537. $stable_sort($weightList);
  27538. $sortedPackages = array();
  27539. foreach (array_keys($weightList) as $name) {
  27540. $sortedPackages[] = $packages[$name];
  27541. }
  27542. return $sortedPackages;
  27543. }
  27544. }
  27545. <?php
  27546. namespace Composer\Util;
  27547. use Composer\IO\IOInterface;
  27548. use Symfony\Component\Process\Process;
  27549. class Perforce
  27550. {
  27551. protected $path;
  27552. protected $p4Depot;
  27553. protected $p4Client;
  27554. protected $p4User;
  27555. protected $p4Password;
  27556. protected $p4Port;
  27557. protected $p4Stream;
  27558. protected $p4ClientSpec;
  27559. protected $p4DepotType;
  27560. protected $p4Branch;
  27561. protected $process;
  27562. protected $uniquePerforceClientName;
  27563. protected $windowsFlag;
  27564. protected $commandResult;
  27565. protected $io;
  27566. protected $filesystem;
  27567. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  27568. {
  27569. $this->windowsFlag = $isWindows;
  27570. $this->p4Port = $port;
  27571. $this->initializePath($path);
  27572. $this->process = $process;
  27573. $this->initialize($repoConfig);
  27574. $this->io = $io;
  27575. }
  27576. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  27577. {
  27578. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  27579. }
  27580. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  27581. {
  27582. $output = null;
  27583. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  27584. }
  27585. public function initialize($repoConfig)
  27586. {
  27587. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  27588. if (!$repoConfig) {
  27589. return;
  27590. }
  27591. if (isset($repoConfig['unique_perforce_client_name'])) {
  27592. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  27593. }
  27594. if (isset($repoConfig['depot'])) {
  27595. $this->p4Depot = $repoConfig['depot'];
  27596. }
  27597. if (isset($repoConfig['branch'])) {
  27598. $this->p4Branch = $repoConfig['branch'];
  27599. }
  27600. if (isset($repoConfig['p4user'])) {
  27601. $this->p4User = $repoConfig['p4user'];
  27602. } else {
  27603. $this->p4User = $this->getP4variable('P4USER');
  27604. }
  27605. if (isset($repoConfig['p4password'])) {
  27606. $this->p4Password = $repoConfig['p4password'];
  27607. }
  27608. }
  27609. public function initializeDepotAndBranch($depot, $branch)
  27610. {
  27611. if (isset($depot)) {
  27612. $this->p4Depot = $depot;
  27613. }
  27614. if (isset($branch)) {
  27615. $this->p4Branch = $branch;
  27616. }
  27617. }
  27618. public function generateUniquePerforceClientName()
  27619. {
  27620. return gethostname() . "_" . time();
  27621. }
  27622. public function cleanupClientSpec()
  27623. {
  27624. $client = $this->getClient();
  27625. $task = 'client -d ' . ProcessExecutor::escape($client);
  27626. $useP4Client = false;
  27627. $command = $this->generateP4Command($task, $useP4Client);
  27628. $this->executeCommand($command);
  27629. $clientSpec = $this->getP4ClientSpec();
  27630. $fileSystem = $this->getFilesystem();
  27631. $fileSystem->remove($clientSpec);
  27632. }
  27633. protected function executeCommand($command)
  27634. {
  27635. $this->commandResult = '';
  27636. return $this->process->execute($command, $this->commandResult);
  27637. }
  27638. public function getClient()
  27639. {
  27640. if (!isset($this->p4Client)) {
  27641. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  27642. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  27643. }
  27644. return $this->p4Client;
  27645. }
  27646. protected function getPath()
  27647. {
  27648. return $this->path;
  27649. }
  27650. public function initializePath($path)
  27651. {
  27652. $this->path = $path;
  27653. $fs = $this->getFilesystem();
  27654. $fs->ensureDirectoryExists($path);
  27655. }
  27656. protected function getPort()
  27657. {
  27658. return $this->p4Port;
  27659. }
  27660. public function setStream($stream)
  27661. {
  27662. $this->p4Stream = $stream;
  27663. $index = strrpos($stream, '/');
  27664. if ($index > 2) {
  27665. $this->p4DepotType = 'stream';
  27666. }
  27667. }
  27668. public function isStream()
  27669. {
  27670. return (strcmp($this->p4DepotType, 'stream') === 0);
  27671. }
  27672. public function getStream()
  27673. {
  27674. if (!isset($this->p4Stream)) {
  27675. if ($this->isStream()) {
  27676. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  27677. } else {
  27678. $this->p4Stream = '//' . $this->p4Depot;
  27679. }
  27680. }
  27681. return $this->p4Stream;
  27682. }
  27683. public function getStreamWithoutLabel($stream)
  27684. {
  27685. $index = strpos($stream, '@');
  27686. if ($index === false) {
  27687. return $stream;
  27688. }
  27689. return substr($stream, 0, $index);
  27690. }
  27691. public function getP4ClientSpec()
  27692. {
  27693. return $this->path . '/' . $this->getClient() . '.p4.spec';
  27694. }
  27695. public function getUser()
  27696. {
  27697. return $this->p4User;
  27698. }
  27699. public function setUser($user)
  27700. {
  27701. $this->p4User = $user;
  27702. }
  27703. public function queryP4User()
  27704. {
  27705. $this->getUser();
  27706. if (strlen($this->p4User) > 0) {
  27707. return;
  27708. }
  27709. $this->p4User = $this->getP4variable('P4USER');
  27710. if (strlen($this->p4User) > 0) {
  27711. return;
  27712. }
  27713. $this->p4User = $this->io->ask('Enter P4 User:');
  27714. if ($this->windowsFlag) {
  27715. $command = 'p4 set P4USER=' . $this->p4User;
  27716. } else {
  27717. $command = 'export P4USER=' . $this->p4User;
  27718. }
  27719. $this->executeCommand($command);
  27720. }
  27721. protected function getP4variable($name)
  27722. {
  27723. if ($this->windowsFlag) {
  27724. $command = 'p4 set';
  27725. $this->executeCommand($command);
  27726. $result = trim($this->commandResult);
  27727. $resArray = explode(PHP_EOL, $result);
  27728. foreach ($resArray as $line) {
  27729. $fields = explode('=', $line);
  27730. if (strcmp($name, $fields[0]) == 0) {
  27731. $index = strpos($fields[1], ' ');
  27732. if ($index === false) {
  27733. $value = $fields[1];
  27734. } else {
  27735. $value = substr($fields[1], 0, $index);
  27736. }
  27737. $value = trim($value);
  27738. return $value;
  27739. }
  27740. }
  27741. return null;
  27742. }
  27743. $command = 'echo $' . $name;
  27744. $this->executeCommand($command);
  27745. $result = trim($this->commandResult);
  27746. return $result;
  27747. }
  27748. public function queryP4Password()
  27749. {
  27750. if (isset($this->p4Password)) {
  27751. return $this->p4Password;
  27752. }
  27753. $password = $this->getP4variable('P4PASSWD');
  27754. if (strlen($password) <= 0) {
  27755. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  27756. }
  27757. $this->p4Password = $password;
  27758. return $password;
  27759. }
  27760. public function generateP4Command($command, $useClient = true)
  27761. {
  27762. $p4Command = 'p4 ';
  27763. $p4Command .= '-u ' . $this->getUser() . ' ';
  27764. if ($useClient) {
  27765. $p4Command .= '-c ' . $this->getClient() . ' ';
  27766. }
  27767. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  27768. return $p4Command;
  27769. }
  27770. public function isLoggedIn()
  27771. {
  27772. $command = $this->generateP4Command('login -s', false);
  27773. $exitCode = $this->executeCommand($command);
  27774. if ($exitCode) {
  27775. $errorOutput = $this->process->getErrorOutput();
  27776. $index = strpos($errorOutput, $this->getUser());
  27777. if ($index === false) {
  27778. $index = strpos($errorOutput, 'p4');
  27779. if ($index === false) {
  27780. return false;
  27781. }
  27782. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  27783. }
  27784. throw new \Exception('Invalid user name: ' . $this->getUser());
  27785. }
  27786. return true;
  27787. }
  27788. public function connectClient()
  27789. {
  27790. $p4CreateClientCommand = $this->generateP4Command(
  27791. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  27792. );
  27793. $this->executeCommand($p4CreateClientCommand);
  27794. }
  27795. public function syncCodeBase($sourceReference)
  27796. {
  27797. $prevDir = getcwd();
  27798. chdir($this->path);
  27799. $p4SyncCommand = $this->generateP4Command('sync -f ');
  27800. if (null !== $sourceReference) {
  27801. $p4SyncCommand .= '@' . $sourceReference;
  27802. }
  27803. $this->executeCommand($p4SyncCommand);
  27804. chdir($prevDir);
  27805. }
  27806. public function writeClientSpecToFile($spec)
  27807. {
  27808. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  27809. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  27810. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  27811. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  27812. fwrite($spec, 'Description:' . PHP_EOL);
  27813. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  27814. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  27815. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  27816. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  27817. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  27818. if ($this->isStream()) {
  27819. fwrite($spec, 'Stream:' . PHP_EOL);
  27820. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  27821. } else {
  27822. fwrite(
  27823. $spec,
  27824. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  27825. );
  27826. }
  27827. }
  27828. public function writeP4ClientSpec()
  27829. {
  27830. $clientSpec = $this->getP4ClientSpec();
  27831. $spec = fopen($clientSpec, 'w');
  27832. try {
  27833. $this->writeClientSpecToFile($spec);
  27834. } catch (\Exception $e) {
  27835. fclose($spec);
  27836. throw $e;
  27837. }
  27838. fclose($spec);
  27839. }
  27840. protected function read($pipe, $name)
  27841. {
  27842. if (feof($pipe)) {
  27843. return;
  27844. }
  27845. $line = fgets($pipe);
  27846. while ($line !== false) {
  27847. $line = fgets($pipe);
  27848. }
  27849. }
  27850. public function windowsLogin($password)
  27851. {
  27852. $command = $this->generateP4Command(' login -a');
  27853. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  27854. $process = Process::fromShellCommandline($command, null, null, $password);
  27855. } else {
  27856. $process = new Process($command, null, null, $password);
  27857. }
  27858. return $process->run();
  27859. }
  27860. public function p4Login()
  27861. {
  27862. $this->queryP4User();
  27863. if (!$this->isLoggedIn()) {
  27864. $password = $this->queryP4Password();
  27865. if ($this->windowsFlag) {
  27866. $this->windowsLogin($password);
  27867. } else {
  27868. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  27869. $exitCode = $this->executeCommand($command);
  27870. $result = trim($this->commandResult);
  27871. if ($exitCode) {
  27872. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  27873. }
  27874. }
  27875. }
  27876. }
  27877. public function getComposerInformation($identifier)
  27878. {
  27879. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  27880. if (!$composerFileContent) {
  27881. return;
  27882. }
  27883. return json_decode($composerFileContent, true);
  27884. }
  27885. public function getFileContent($file, $identifier)
  27886. {
  27887. $path = $this->getFilePath($file, $identifier);
  27888. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  27889. $this->executeCommand($command);
  27890. $result = $this->commandResult;
  27891. if (!trim($result)) {
  27892. return null;
  27893. }
  27894. return $result;
  27895. }
  27896. public function getFilePath($file, $identifier)
  27897. {
  27898. $index = strpos($identifier, '@');
  27899. if ($index === false) {
  27900. $path = $identifier. '/' . $file;
  27901. return $path;
  27902. }
  27903. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  27904. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  27905. $this->executeCommand($command);
  27906. $result = $this->commandResult;
  27907. $index2 = strpos($result, 'no such file(s).');
  27908. if ($index2 === false) {
  27909. $index3 = strpos($result, 'change');
  27910. if ($index3 !== false) {
  27911. $phrase = trim(substr($result, $index3));
  27912. $fields = explode(' ', $phrase);
  27913. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  27914. }
  27915. }
  27916. return null;
  27917. }
  27918. public function getBranches()
  27919. {
  27920. $possibleBranches = array();
  27921. if (!$this->isStream()) {
  27922. $possibleBranches[$this->p4Branch] = $this->getStream();
  27923. } else {
  27924. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  27925. $this->executeCommand($command);
  27926. $result = $this->commandResult;
  27927. $resArray = explode(PHP_EOL, $result);
  27928. foreach ($resArray as $line) {
  27929. $resBits = explode(' ', $line);
  27930. if (count($resBits) > 4) {
  27931. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  27932. $possibleBranches[$branch] = $resBits[1];
  27933. }
  27934. }
  27935. }
  27936. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  27937. $this->executeCommand($command);
  27938. $result = $this->commandResult;
  27939. $resArray = explode(PHP_EOL, $result);
  27940. $lastCommit = $resArray[0];
  27941. $lastCommitArr = explode(' ', $lastCommit);
  27942. $lastCommitNum = $lastCommitArr[1];
  27943. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  27944. return $branches;
  27945. }
  27946. public function getTags()
  27947. {
  27948. $command = $this->generateP4Command('labels');
  27949. $this->executeCommand($command);
  27950. $result = $this->commandResult;
  27951. $resArray = explode(PHP_EOL, $result);
  27952. $tags = array();
  27953. foreach ($resArray as $line) {
  27954. if (strpos($line, 'Label') !== false) {
  27955. $fields = explode(' ', $line);
  27956. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  27957. }
  27958. }
  27959. return $tags;
  27960. }
  27961. public function checkStream()
  27962. {
  27963. $command = $this->generateP4Command('depots', false);
  27964. $this->executeCommand($command);
  27965. $result = $this->commandResult;
  27966. $resArray = explode(PHP_EOL, $result);
  27967. foreach ($resArray as $line) {
  27968. if (strpos($line, 'Depot') !== false) {
  27969. $fields = explode(' ', $line);
  27970. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  27971. $this->p4DepotType = $fields[3];
  27972. return $this->isStream();
  27973. }
  27974. }
  27975. }
  27976. return false;
  27977. }
  27978. protected function getChangeList($reference)
  27979. {
  27980. $index = strpos($reference, '@');
  27981. if ($index === false) {
  27982. return null;
  27983. }
  27984. $label = substr($reference, $index);
  27985. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  27986. $this->executeCommand($command);
  27987. $changes = $this->commandResult;
  27988. if (strpos($changes, 'Change') !== 0) {
  27989. return null;
  27990. }
  27991. $fields = explode(' ', $changes);
  27992. return $fields[1];
  27993. }
  27994. public function getCommitLogs($fromReference, $toReference)
  27995. {
  27996. $fromChangeList = $this->getChangeList($fromReference);
  27997. if ($fromChangeList === null) {
  27998. return null;
  27999. }
  28000. $toChangeList = $this->getChangeList($toReference);
  28001. if ($toChangeList === null) {
  28002. return null;
  28003. }
  28004. $index = strpos($fromReference, '@');
  28005. $main = substr($fromReference, 0, $index) . '/...';
  28006. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  28007. $this->executeCommand($command);
  28008. return $this->commandResult;
  28009. }
  28010. public function getFilesystem()
  28011. {
  28012. if (empty($this->filesystem)) {
  28013. $this->filesystem = new Filesystem($this->process);
  28014. }
  28015. return $this->filesystem;
  28016. }
  28017. public function setFilesystem(Filesystem $fs)
  28018. {
  28019. $this->filesystem = $fs;
  28020. }
  28021. }
  28022. <?php
  28023. namespace Composer\Util;
  28024. class Platform
  28025. {
  28026. public static function expandPath($path)
  28027. {
  28028. if (preg_match('#^~[\\/]#', $path)) {
  28029. return self::getUserDirectory() . substr($path, 1);
  28030. }
  28031. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  28032. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  28033. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  28034. }
  28035. return getenv($matches['var']) . $matches['path'];
  28036. }, $path);
  28037. }
  28038. public static function getUserDirectory()
  28039. {
  28040. if (false !== ($home = getenv('HOME'))) {
  28041. return $home;
  28042. }
  28043. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  28044. return $home;
  28045. }
  28046. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  28047. $info = posix_getpwuid(posix_getuid());
  28048. return $info['dir'];
  28049. }
  28050. throw new \RuntimeException('Could not determine user directory');
  28051. }
  28052. public static function isWindows()
  28053. {
  28054. return defined('PHP_WINDOWS_VERSION_BUILD');
  28055. }
  28056. public static function strlen($str)
  28057. {
  28058. static $useMbString = null;
  28059. if (null === $useMbString) {
  28060. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  28061. }
  28062. if ($useMbString) {
  28063. return mb_strlen($str, '8bit');
  28064. }
  28065. return strlen($str);
  28066. }
  28067. }
  28068. <?php
  28069. namespace Composer\Util;
  28070. use Composer\IO\IOInterface;
  28071. use Symfony\Component\Process\Process;
  28072. use Symfony\Component\Process\ProcessUtils;
  28073. class ProcessExecutor
  28074. {
  28075. protected static $timeout = 300;
  28076. protected $captureOutput;
  28077. protected $errorOutput;
  28078. protected $io;
  28079. public function __construct(IOInterface $io = null)
  28080. {
  28081. $this->io = $io;
  28082. }
  28083. public function execute($command, &$output = null, $cwd = null)
  28084. {
  28085. if ($this->io && $this->io->isDebug()) {
  28086. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  28087. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  28088. return '://***:***@';
  28089. }
  28090. return '://'.$m['user'].':***@';
  28091. }, $command);
  28092. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  28093. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  28094. }
  28095. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  28096. $cwd = realpath(getcwd());
  28097. }
  28098. $this->captureOutput = func_num_args() > 1;
  28099. $this->errorOutput = null;
  28100. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  28101. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  28102. } else {
  28103. $process = new Process($command, $cwd, null, null, static::getTimeout());
  28104. }
  28105. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  28106. $process->run($callback);
  28107. if ($this->captureOutput && !is_callable($output)) {
  28108. $output = $process->getOutput();
  28109. }
  28110. $this->errorOutput = $process->getErrorOutput();
  28111. return $process->getExitCode();
  28112. }
  28113. public function splitLines($output)
  28114. {
  28115. $output = trim($output);
  28116. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  28117. }
  28118. public function getErrorOutput()
  28119. {
  28120. return $this->errorOutput;
  28121. }
  28122. public function outputHandler($type, $buffer)
  28123. {
  28124. if ($this->captureOutput) {
  28125. return;
  28126. }
  28127. if (null === $this->io) {
  28128. echo $buffer;
  28129. return;
  28130. }
  28131. if (method_exists($this->io, 'writeRaw')) {
  28132. if (Process::ERR === $type) {
  28133. $this->io->writeErrorRaw($buffer, false);
  28134. } else {
  28135. $this->io->writeRaw($buffer, false);
  28136. }
  28137. } else {
  28138. if (Process::ERR === $type) {
  28139. $this->io->writeError($buffer, false);
  28140. } else {
  28141. $this->io->write($buffer, false);
  28142. }
  28143. }
  28144. }
  28145. public static function getTimeout()
  28146. {
  28147. return static::$timeout;
  28148. }
  28149. public static function setTimeout($timeout)
  28150. {
  28151. static::$timeout = $timeout;
  28152. }
  28153. public static function escape($argument)
  28154. {
  28155. return self::escapeArgument($argument);
  28156. }
  28157. private static function escapeArgument($argument)
  28158. {
  28159. if ('\\' === DIRECTORY_SEPARATOR) {
  28160. if ((string) $argument === '') {
  28161. return escapeshellarg($argument);
  28162. }
  28163. $escapedArgument = '';
  28164. $quote = false;
  28165. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  28166. if ('"' === $part) {
  28167. $escapedArgument .= '\\"';
  28168. } elseif (self::isSurroundedBy($part, '%')) {
  28169. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  28170. } else {
  28171. if ('\\' === substr($part, -1)) {
  28172. $part .= '\\';
  28173. }
  28174. $quote = true;
  28175. $escapedArgument .= $part;
  28176. }
  28177. }
  28178. if ($quote) {
  28179. $escapedArgument = '"'.$escapedArgument.'"';
  28180. }
  28181. return $escapedArgument;
  28182. }
  28183. return "'".str_replace("'", "'\\''", $argument)."'";
  28184. }
  28185. private static function isSurroundedBy($arg, $char)
  28186. {
  28187. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  28188. }
  28189. }
  28190. <?php
  28191. namespace Composer\Util;
  28192. use Composer\Config;
  28193. use Composer\Composer;
  28194. use Composer\Semver\Constraint\Constraint;
  28195. use Composer\Package\Version\VersionParser;
  28196. use Composer\IO\IOInterface;
  28197. use Composer\Downloader\TransportException;
  28198. use Composer\CaBundle\CaBundle;
  28199. use Psr\Log\LoggerInterface;
  28200. class RemoteFilesystem
  28201. {
  28202. private $io;
  28203. private $config;
  28204. private $scheme;
  28205. private $bytesMax;
  28206. private $originUrl;
  28207. private $fileUrl;
  28208. private $fileName;
  28209. private $retry;
  28210. private $progress;
  28211. private $lastProgress;
  28212. private $options = array();
  28213. private $peerCertificateMap = array();
  28214. private $disableTls = false;
  28215. private $retryAuthFailure;
  28216. private $lastHeaders;
  28217. private $storeAuth;
  28218. private $degradedMode = false;
  28219. private $redirects;
  28220. private $maxRedirects = 20;
  28221. private $displayedOriginAuthentications = array();
  28222. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  28223. {
  28224. $this->io = $io;
  28225. if ($disableTls === false) {
  28226. $this->options = $this->getTlsDefaults($options);
  28227. } else {
  28228. $this->disableTls = true;
  28229. }
  28230. $this->options = array_replace_recursive($this->options, $options);
  28231. $this->config = $config;
  28232. }
  28233. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  28234. {
  28235. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  28236. }
  28237. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  28238. {
  28239. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  28240. }
  28241. public function getOptions()
  28242. {
  28243. return $this->options;
  28244. }
  28245. public function setOptions(array $options)
  28246. {
  28247. $this->options = array_replace_recursive($this->options, $options);
  28248. }
  28249. public function isTlsDisabled()
  28250. {
  28251. return $this->disableTls === true;
  28252. }
  28253. public function getLastHeaders()
  28254. {
  28255. return $this->lastHeaders;
  28256. }
  28257. public function findHeaderValue(array $headers, $name)
  28258. {
  28259. $value = null;
  28260. foreach ($headers as $header) {
  28261. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  28262. $value = $match[1];
  28263. } elseif (preg_match('{^HTTP/}i', $header)) {
  28264. $value = null;
  28265. }
  28266. }
  28267. return $value;
  28268. }
  28269. public function findStatusCode(array $headers)
  28270. {
  28271. $value = null;
  28272. foreach ($headers as $header) {
  28273. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  28274. $value = (int) $match[1];
  28275. }
  28276. }
  28277. return $value;
  28278. }
  28279. public function findStatusMessage(array $headers)
  28280. {
  28281. $value = null;
  28282. foreach ($headers as $header) {
  28283. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  28284. $value = $header;
  28285. }
  28286. }
  28287. return $value;
  28288. }
  28289. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  28290. {
  28291. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  28292. $originUrl = 'github.com';
  28293. }
  28294. if (
  28295. $this->config
  28296. && is_array($this->config->get('gitlab-domains'))
  28297. && false === strpos($originUrl, '/')
  28298. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  28299. ) {
  28300. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  28301. if (0 === strpos($gitlabDomain, $originUrl)) {
  28302. $originUrl = $gitlabDomain;
  28303. break;
  28304. }
  28305. }
  28306. unset($gitlabDomain);
  28307. }
  28308. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  28309. $this->bytesMax = 0;
  28310. $this->originUrl = $originUrl;
  28311. $this->fileUrl = $fileUrl;
  28312. $this->fileName = $fileName;
  28313. $this->progress = $progress;
  28314. $this->lastProgress = null;
  28315. $this->retryAuthFailure = true;
  28316. $this->lastHeaders = array();
  28317. $this->redirects = 1;
  28318. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  28319. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  28320. }
  28321. $tempAdditionalOptions = $additionalOptions;
  28322. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  28323. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  28324. unset($tempAdditionalOptions['retry-auth-failure']);
  28325. }
  28326. $isRedirect = false;
  28327. if (isset($tempAdditionalOptions['redirects'])) {
  28328. $this->redirects = $tempAdditionalOptions['redirects'];
  28329. $isRedirect = true;
  28330. unset($tempAdditionalOptions['redirects']);
  28331. }
  28332. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  28333. unset($tempAdditionalOptions);
  28334. $origFileUrl = $fileUrl;
  28335. if (isset($options['github-token'])) {
  28336. if (preg_match('{^https?://api\.github\.com/}', $fileUrl)) {
  28337. $options['http']['header'][] = 'Authorization: token '.$options['github-token'];
  28338. }
  28339. unset($options['github-token']);
  28340. }
  28341. if (isset($options['gitlab-token'])) {
  28342. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  28343. unset($options['gitlab-token']);
  28344. }
  28345. if (isset($options['http'])) {
  28346. $options['http']['ignore_errors'] = true;
  28347. }
  28348. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  28349. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  28350. $degradedPackagist = true;
  28351. }
  28352. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  28353. $actualContextOptions = stream_context_get_options($ctx);
  28354. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  28355. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  28356. unset($origFileUrl, $actualContextOptions);
  28357. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  28358. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  28359. }
  28360. if ($this->progress && !$isRedirect) {
  28361. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  28362. }
  28363. $errorMessage = '';
  28364. $errorCode = 0;
  28365. $result = false;
  28366. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28367. if ($errorMessage) {
  28368. $errorMessage .= "\n";
  28369. }
  28370. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  28371. return true;
  28372. });
  28373. try {
  28374. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  28375. if (!empty($http_response_header[0])) {
  28376. $statusCode = $this->findStatusCode($http_response_header);
  28377. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  28378. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  28379. }
  28380. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  28381. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  28382. }
  28383. }
  28384. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  28385. if ($contentLength && Platform::strlen($result) < $contentLength) {
  28386. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  28387. $e->setHeaders($http_response_header);
  28388. $e->setStatusCode($this->findStatusCode($http_response_header));
  28389. $e->setResponse($result);
  28390. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  28391. throw $e;
  28392. }
  28393. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  28394. $params = stream_context_get_params($ctx);
  28395. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  28396. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  28397. if ($expectedPeerFingerprint !== $peerFingerprint) {
  28398. throw new TransportException('Peer fingerprint did not match');
  28399. }
  28400. }
  28401. } catch (\Exception $e) {
  28402. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  28403. $e->setHeaders($http_response_header);
  28404. $e->setStatusCode($this->findStatusCode($http_response_header));
  28405. }
  28406. if ($e instanceof TransportException && $result !== false) {
  28407. $e->setResponse($result);
  28408. }
  28409. $result = false;
  28410. }
  28411. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  28412. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  28413. }
  28414. restore_error_handler();
  28415. if (isset($e) && !$this->retry) {
  28416. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28417. $this->degradedMode = true;
  28418. $this->io->writeError('');
  28419. $this->io->writeError(array(
  28420. '<error>'.$e->getMessage().'</error>',
  28421. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28422. ));
  28423. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28424. }
  28425. throw $e;
  28426. }
  28427. $statusCode = null;
  28428. $contentType = null;
  28429. $locationHeader = null;
  28430. if (!empty($http_response_header[0])) {
  28431. $statusCode = $this->findStatusCode($http_response_header);
  28432. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  28433. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  28434. }
  28435. if ($originUrl === 'bitbucket.org'
  28436. && !$this->isPublicBitBucketDownload($fileUrl)
  28437. && substr($fileUrl, -4) === '.zip'
  28438. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  28439. && $contentType && preg_match('{^text/html\b}i', $contentType)
  28440. ) {
  28441. $result = false;
  28442. if ($this->retryAuthFailure) {
  28443. $this->promptAuthAndRetry(401);
  28444. }
  28445. }
  28446. if ($statusCode === 404
  28447. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  28448. && false !== strpos($fileUrl, 'archive.zip')
  28449. ) {
  28450. $result = false;
  28451. if ($this->retryAuthFailure) {
  28452. $this->promptAuthAndRetry(401);
  28453. }
  28454. }
  28455. $hasFollowedRedirect = false;
  28456. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  28457. $hasFollowedRedirect = true;
  28458. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  28459. }
  28460. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  28461. if (!$this->retry) {
  28462. if ($this->progress && !$this->retry && !$isRedirect) {
  28463. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  28464. }
  28465. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  28466. $e->setHeaders($http_response_header);
  28467. $e->setResponse($result);
  28468. $e->setStatusCode($statusCode);
  28469. throw $e;
  28470. }
  28471. $result = false;
  28472. }
  28473. if ($this->progress && !$this->retry && !$isRedirect) {
  28474. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  28475. }
  28476. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  28477. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  28478. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  28479. if ($decode) {
  28480. try {
  28481. if (PHP_VERSION_ID >= 50400) {
  28482. $result = zlib_decode($result);
  28483. } else {
  28484. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  28485. }
  28486. if (!$result) {
  28487. throw new TransportException('Failed to decode zlib stream');
  28488. }
  28489. } catch (\Exception $e) {
  28490. if ($this->degradedMode) {
  28491. throw $e;
  28492. }
  28493. $this->degradedMode = true;
  28494. $this->io->writeError(array(
  28495. '',
  28496. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  28497. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28498. ));
  28499. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28500. }
  28501. }
  28502. }
  28503. if (false !== $result && null !== $fileName && !$isRedirect) {
  28504. if ('' === $result) {
  28505. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  28506. }
  28507. $errorMessage = '';
  28508. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28509. if ($errorMessage) {
  28510. $errorMessage .= "\n";
  28511. }
  28512. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  28513. return true;
  28514. });
  28515. $result = (bool) file_put_contents($fileName, $result);
  28516. restore_error_handler();
  28517. if (false === $result) {
  28518. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  28519. }
  28520. }
  28521. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  28522. if (CaBundle::isOpensslParseSafe()) {
  28523. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  28524. if ($certDetails) {
  28525. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  28526. $this->retry = true;
  28527. }
  28528. } else {
  28529. $this->io->writeError('');
  28530. $this->io->writeError(sprintf(
  28531. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  28532. PHP_VERSION
  28533. ));
  28534. }
  28535. }
  28536. if ($this->retry) {
  28537. $this->retry = false;
  28538. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28539. if ($this->storeAuth && $this->config) {
  28540. $authHelper = new AuthHelper($this->io, $this->config);
  28541. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  28542. $this->storeAuth = false;
  28543. }
  28544. return $result;
  28545. }
  28546. if (false === $result) {
  28547. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  28548. if (!empty($http_response_header[0])) {
  28549. $e->setHeaders($http_response_header);
  28550. }
  28551. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28552. $this->degradedMode = true;
  28553. $this->io->writeError('');
  28554. $this->io->writeError(array(
  28555. '<error>'.$e->getMessage().'</error>',
  28556. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28557. ));
  28558. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28559. }
  28560. throw $e;
  28561. }
  28562. if (!empty($http_response_header[0])) {
  28563. $this->lastHeaders = $http_response_header;
  28564. }
  28565. return $result;
  28566. }
  28567. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  28568. {
  28569. try {
  28570. $e = null;
  28571. $result = file_get_contents($fileUrl, false, $context);
  28572. } catch (\Throwable $e) {
  28573. } catch (\Exception $e) {
  28574. }
  28575. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  28576. if (null !== $e) {
  28577. throw $e;
  28578. }
  28579. return $result;
  28580. }
  28581. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  28582. {
  28583. switch ($notificationCode) {
  28584. case STREAM_NOTIFY_FAILURE:
  28585. if (400 === $messageCode) {
  28586. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  28587. }
  28588. break;
  28589. case STREAM_NOTIFY_FILE_SIZE_IS:
  28590. $this->bytesMax = $bytesMax;
  28591. break;
  28592. case STREAM_NOTIFY_PROGRESS:
  28593. if ($this->bytesMax > 0 && $this->progress) {
  28594. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  28595. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  28596. $this->lastProgress = $progression;
  28597. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  28598. }
  28599. }
  28600. break;
  28601. default:
  28602. break;
  28603. }
  28604. }
  28605. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  28606. {
  28607. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  28608. $gitHubUtil = new GitHub($this->io, $this->config, null);
  28609. $message = "\n";
  28610. $rateLimited = $gitHubUtil->isRateLimited($headers);
  28611. if ($rateLimited) {
  28612. $rateLimit = $gitHubUtil->getRateLimit($headers);
  28613. if ($this->io->hasAuthentication($this->originUrl)) {
  28614. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  28615. } else {
  28616. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  28617. }
  28618. $message = sprintf(
  28619. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  28620. $rateLimit['limit'],
  28621. $rateLimit['reset']
  28622. )."\n";
  28623. } else {
  28624. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  28625. if ($this->io->hasAuthentication($this->originUrl)) {
  28626. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  28627. } else {
  28628. $message .= 'create a GitHub OAuth token to access private repos';
  28629. }
  28630. }
  28631. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  28632. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28633. ) {
  28634. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28635. }
  28636. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  28637. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  28638. $gitLabUtil = new GitLab($this->io, $this->config, null);
  28639. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) {
  28640. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28641. }
  28642. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  28643. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  28644. ) {
  28645. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28646. }
  28647. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  28648. $askForOAuthToken = true;
  28649. if ($this->io->hasAuthentication($this->originUrl)) {
  28650. $auth = $this->io->getAuthentication($this->originUrl);
  28651. if ($auth['username'] !== 'x-token-auth') {
  28652. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  28653. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  28654. if (!empty($accessToken)) {
  28655. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  28656. $askForOAuthToken = false;
  28657. }
  28658. } else {
  28659. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28660. }
  28661. }
  28662. if ($askForOAuthToken) {
  28663. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  28664. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  28665. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  28666. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28667. ) {
  28668. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28669. }
  28670. }
  28671. } else {
  28672. if ($httpStatus === 404) {
  28673. return;
  28674. }
  28675. if (!$this->io->isInteractive()) {
  28676. if ($httpStatus === 401) {
  28677. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  28678. }
  28679. if ($httpStatus === 403) {
  28680. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  28681. }
  28682. throw new TransportException($message, $httpStatus);
  28683. }
  28684. if ($this->io->hasAuthentication($this->originUrl)) {
  28685. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28686. }
  28687. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  28688. $username = $this->io->ask(' Username: ');
  28689. $password = $this->io->askAndHideAnswer(' Password: ');
  28690. $this->io->setAuthentication($this->originUrl, $username, $password);
  28691. $this->storeAuth = $this->config->get('store-auths');
  28692. }
  28693. $this->retry = true;
  28694. throw new TransportException('RETRY');
  28695. }
  28696. protected function getOptionsForUrl($originUrl, $additionalOptions)
  28697. {
  28698. $tlsOptions = array();
  28699. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  28700. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  28701. if (PHP_VERSION_ID < 50304) {
  28702. if ($host === 'github.com' || $host === 'api.github.com') {
  28703. $host = '*.github.com';
  28704. }
  28705. }
  28706. $tlsOptions['ssl']['CN_match'] = $host;
  28707. $tlsOptions['ssl']['SNI_server_name'] = $host;
  28708. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  28709. if (isset($this->peerCertificateMap[$urlAuthority])) {
  28710. $certMap = $this->peerCertificateMap[$urlAuthority];
  28711. $this->io->writeError('', true, IOInterface::DEBUG);
  28712. $this->io->writeError(sprintf(
  28713. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  28714. $certMap['cn'],
  28715. $urlAuthority
  28716. ), true, IOInterface::DEBUG);
  28717. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  28718. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  28719. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  28720. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  28721. }
  28722. }
  28723. $headers = array();
  28724. if (extension_loaded('zlib')) {
  28725. $headers[] = 'Accept-Encoding: gzip';
  28726. }
  28727. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  28728. if (!$this->degradedMode) {
  28729. $options['http']['protocol_version'] = 1.1;
  28730. $headers[] = 'Connection: close';
  28731. }
  28732. if ($this->io->hasAuthentication($originUrl)) {
  28733. $authenticationDisplayMessage = null;
  28734. $auth = $this->io->getAuthentication($originUrl);
  28735. if ($auth['password'] === 'bearer') {
  28736. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28737. } elseif ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  28738. $options['github-token'] = $auth['username'];
  28739. $authenticationDisplayMessage = 'Using GitHub token authentication';
  28740. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  28741. if ($auth['password'] === 'oauth2') {
  28742. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28743. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  28744. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  28745. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  28746. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  28747. }
  28748. } elseif ('bitbucket.org' === $originUrl
  28749. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  28750. ) {
  28751. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  28752. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  28753. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  28754. }
  28755. } else {
  28756. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  28757. $headers[] = 'Authorization: Basic '.$authStr;
  28758. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  28759. }
  28760. if ($authenticationDisplayMessage && !in_array($originUrl, $this->displayedOriginAuthentications, true)) {
  28761. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  28762. $this->displayedOriginAuthentications[] = $originUrl;
  28763. }
  28764. }
  28765. $options['http']['follow_location'] = 0;
  28766. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  28767. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  28768. }
  28769. foreach ($headers as $header) {
  28770. $options['http']['header'][] = $header;
  28771. }
  28772. return $options;
  28773. }
  28774. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  28775. {
  28776. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  28777. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  28778. $targetUrl = $locationHeader;
  28779. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  28780. $targetUrl = $this->scheme.':'.$locationHeader;
  28781. } elseif ('/' === $locationHeader[0]) {
  28782. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  28783. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28784. } else {
  28785. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28786. }
  28787. }
  28788. if (!empty($targetUrl)) {
  28789. $this->redirects++;
  28790. $this->io->writeError('', true, IOInterface::DEBUG);
  28791. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  28792. $additionalOptions['redirects'] = $this->redirects;
  28793. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  28794. }
  28795. if (!$this->retry) {
  28796. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  28797. $e->setHeaders($http_response_header);
  28798. $e->setResponse($result);
  28799. throw $e;
  28800. }
  28801. return false;
  28802. }
  28803. private function getTlsDefaults(array $options)
  28804. {
  28805. $ciphers = implode(':', array(
  28806. 'ECDHE-RSA-AES128-GCM-SHA256',
  28807. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  28808. 'ECDHE-RSA-AES256-GCM-SHA384',
  28809. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  28810. 'DHE-RSA-AES128-GCM-SHA256',
  28811. 'DHE-DSS-AES128-GCM-SHA256',
  28812. 'kEDH+AESGCM',
  28813. 'ECDHE-RSA-AES128-SHA256',
  28814. 'ECDHE-ECDSA-AES128-SHA256',
  28815. 'ECDHE-RSA-AES128-SHA',
  28816. 'ECDHE-ECDSA-AES128-SHA',
  28817. 'ECDHE-RSA-AES256-SHA384',
  28818. 'ECDHE-ECDSA-AES256-SHA384',
  28819. 'ECDHE-RSA-AES256-SHA',
  28820. 'ECDHE-ECDSA-AES256-SHA',
  28821. 'DHE-RSA-AES128-SHA256',
  28822. 'DHE-RSA-AES128-SHA',
  28823. 'DHE-DSS-AES128-SHA256',
  28824. 'DHE-RSA-AES256-SHA256',
  28825. 'DHE-DSS-AES256-SHA',
  28826. 'DHE-RSA-AES256-SHA',
  28827. 'AES128-GCM-SHA256',
  28828. 'AES256-GCM-SHA384',
  28829. 'AES128-SHA256',
  28830. 'AES256-SHA256',
  28831. 'AES128-SHA',
  28832. 'AES256-SHA',
  28833. 'AES',
  28834. 'CAMELLIA',
  28835. 'DES-CBC3-SHA',
  28836. '!aNULL',
  28837. '!eNULL',
  28838. '!EXPORT',
  28839. '!DES',
  28840. '!RC4',
  28841. '!MD5',
  28842. '!PSK',
  28843. '!aECDH',
  28844. '!EDH-DSS-DES-CBC3-SHA',
  28845. '!EDH-RSA-DES-CBC3-SHA',
  28846. '!KRB5-DES-CBC3-SHA',
  28847. ));
  28848. $defaults = array(
  28849. 'ssl' => array(
  28850. 'ciphers' => $ciphers,
  28851. 'verify_peer' => true,
  28852. 'verify_depth' => 7,
  28853. 'SNI_enabled' => true,
  28854. 'capture_peer_cert' => true,
  28855. ),
  28856. );
  28857. if (isset($options['ssl'])) {
  28858. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  28859. }
  28860. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  28861. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  28862. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  28863. if (is_dir($result)) {
  28864. $defaults['ssl']['capath'] = $result;
  28865. } else {
  28866. $defaults['ssl']['cafile'] = $result;
  28867. }
  28868. }
  28869. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  28870. throw new TransportException('The configured cafile was not valid or could not be read.');
  28871. }
  28872. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  28873. throw new TransportException('The configured capath was not valid or could not be read.');
  28874. }
  28875. if (PHP_VERSION_ID >= 50413) {
  28876. $defaults['ssl']['disable_compression'] = true;
  28877. }
  28878. return $defaults;
  28879. }
  28880. private function getCertificateCnAndFp($url, $options)
  28881. {
  28882. if (PHP_VERSION_ID >= 50600) {
  28883. throw new \BadMethodCallException(sprintf(
  28884. '%s must not be used on PHP >= 5.6',
  28885. __METHOD__
  28886. ));
  28887. }
  28888. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  28889. 'ssl' => array(
  28890. 'capture_peer_cert' => true,
  28891. 'verify_peer' => false,
  28892. ), ),
  28893. ));
  28894. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  28895. return;
  28896. }
  28897. fclose($handle);
  28898. $handle = null;
  28899. $params = stream_context_get_params($context);
  28900. if (!empty($params['options']['ssl']['peer_certificate'])) {
  28901. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  28902. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  28903. return array(
  28904. 'cn' => $commonName,
  28905. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  28906. );
  28907. }
  28908. }
  28909. }
  28910. private function getUrlAuthority($url)
  28911. {
  28912. $defaultPorts = array(
  28913. 'ftp' => 21,
  28914. 'http' => 80,
  28915. 'https' => 443,
  28916. 'ssh2.sftp' => 22,
  28917. 'ssh2.scp' => 22,
  28918. );
  28919. $scheme = parse_url($url, PHP_URL_SCHEME);
  28920. if (!isset($defaultPorts[$scheme])) {
  28921. throw new \InvalidArgumentException(sprintf(
  28922. 'Could not get default port for unknown scheme: %s',
  28923. $scheme
  28924. ));
  28925. }
  28926. $defaultPort = $defaultPorts[$scheme];
  28927. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  28928. return parse_url($url, PHP_URL_HOST).':'.$port;
  28929. }
  28930. private function isPublicBitBucketDownload($urlToBitBucketFile)
  28931. {
  28932. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  28933. if (strpos($domain, 'bitbucket.org') === false) {
  28934. return true;
  28935. }
  28936. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  28937. $pathParts = explode('/', $path);
  28938. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  28939. }
  28940. public static function outputWarnings(IOInterface $io, $url, $data)
  28941. {
  28942. foreach (array('warning', 'info') as $type) {
  28943. if (empty($data[$type])) {
  28944. continue;
  28945. }
  28946. if (!empty($data[$type . '-versions'])) {
  28947. $versionParser = new VersionParser();
  28948. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  28949. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  28950. if (!$constraint->matches($composer)) {
  28951. continue;
  28952. }
  28953. }
  28954. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  28955. }
  28956. }
  28957. public static function getOrigin($urlOrPath)
  28958. {
  28959. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  28960. if (!$hostPort) {
  28961. return $urlOrPath;
  28962. }
  28963. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  28964. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  28965. }
  28966. return $hostPort;
  28967. }
  28968. private function stripCredentialsFromUrl($url)
  28969. {
  28970. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  28971. }
  28972. }
  28973. <?php
  28974. namespace Composer\Util;
  28975. class Silencer
  28976. {
  28977. private static $stack = array();
  28978. public static function suppress($mask = null)
  28979. {
  28980. if (!isset($mask)) {
  28981. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  28982. }
  28983. $old = error_reporting();
  28984. self::$stack[] = $old;
  28985. error_reporting($old & ~$mask);
  28986. return $old;
  28987. }
  28988. public static function restore()
  28989. {
  28990. if (!empty(self::$stack)) {
  28991. error_reporting(array_pop(self::$stack));
  28992. }
  28993. }
  28994. public static function call($callable )
  28995. {
  28996. try {
  28997. self::suppress();
  28998. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  28999. self::restore();
  29000. return $result;
  29001. } catch (\Exception $e) {
  29002. self::restore();
  29003. throw $e;
  29004. }
  29005. }
  29006. }
  29007. <?php
  29008. namespace Composer\Util;
  29009. use Composer\Spdx\SpdxLicenses;
  29010. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  29011. class SpdxLicense extends SpdxLicenses
  29012. {
  29013. }
  29014. <?php
  29015. namespace Composer\Util;
  29016. use Composer\Composer;
  29017. final class StreamContextFactory
  29018. {
  29019. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  29020. {
  29021. $options = array('http' => array(
  29022. 'follow_location' => 1,
  29023. 'max_redirects' => 20,
  29024. ));
  29025. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  29026. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  29027. }
  29028. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  29029. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  29030. }
  29031. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  29032. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  29033. }
  29034. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  29035. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  29036. if ($pattern->test($url)) {
  29037. unset($proxy);
  29038. }
  29039. }
  29040. if (!empty($proxy)) {
  29041. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  29042. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  29043. if (isset($proxy['port'])) {
  29044. $proxyURL .= ":" . $proxy['port'];
  29045. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  29046. $proxyURL .= ":80";
  29047. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  29048. $proxyURL .= ":443";
  29049. }
  29050. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  29051. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  29052. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  29053. }
  29054. $options['http']['proxy'] = $proxyURL;
  29055. switch (parse_url($url, PHP_URL_SCHEME)) {
  29056. case 'http':
  29057. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  29058. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29059. $options['http']['request_fulluri'] = true;
  29060. }
  29061. break;
  29062. case 'https':
  29063. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  29064. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29065. $options['http']['request_fulluri'] = true;
  29066. }
  29067. break;
  29068. }
  29069. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  29070. $options['ssl']['SNI_enabled'] = true;
  29071. if (PHP_VERSION_ID < 50600) {
  29072. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  29073. }
  29074. }
  29075. if (isset($proxy['user'])) {
  29076. $auth = rawurldecode($proxy['user']);
  29077. if (isset($proxy['pass'])) {
  29078. $auth .= ':' . rawurldecode($proxy['pass']);
  29079. }
  29080. $auth = base64_encode($auth);
  29081. if (isset($defaultOptions['http']['header'])) {
  29082. if (is_string($defaultOptions['http']['header'])) {
  29083. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  29084. }
  29085. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  29086. } else {
  29087. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  29088. }
  29089. }
  29090. }
  29091. $options = array_replace_recursive($options, $defaultOptions);
  29092. if (isset($options['http']['header'])) {
  29093. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  29094. }
  29095. if (defined('HHVM_VERSION')) {
  29096. $phpVersion = 'HHVM ' . HHVM_VERSION;
  29097. } else {
  29098. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  29099. }
  29100. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  29101. $options['http']['header'][] = sprintf(
  29102. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  29103. Composer::getVersion(),
  29104. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  29105. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  29106. $phpVersion,
  29107. getenv('CI') ? '; CI' : ''
  29108. );
  29109. }
  29110. return stream_context_create($options, $defaultParams);
  29111. }
  29112. private static function fixHttpHeaderField($header)
  29113. {
  29114. if (!is_array($header)) {
  29115. $header = explode("\r\n", $header);
  29116. }
  29117. uasort($header, function ($el) {
  29118. return stripos($el, 'content-type') === 0 ? 1 : -1;
  29119. });
  29120. return $header;
  29121. }
  29122. }
  29123. <?php
  29124. namespace Composer\Util;
  29125. use Composer\Config;
  29126. use Composer\IO\IOInterface;
  29127. class Svn
  29128. {
  29129. const MAX_QTY_AUTH_TRIES = 5;
  29130. protected $credentials;
  29131. protected $hasAuth;
  29132. protected $io;
  29133. protected $url;
  29134. protected $cacheCredentials = true;
  29135. protected $process;
  29136. protected $qtyAuthTries = 0;
  29137. protected $config;
  29138. private static $version;
  29139. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  29140. {
  29141. $this->url = $url;
  29142. $this->io = $io;
  29143. $this->config = $config;
  29144. $this->process = $process ?: new ProcessExecutor($io);
  29145. }
  29146. public static function cleanEnv()
  29147. {
  29148. putenv("DYLD_LIBRARY_PATH");
  29149. unset($_SERVER['DYLD_LIBRARY_PATH']);
  29150. }
  29151. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  29152. {
  29153. $this->config->prohibitUrlByConfig($url, $this->io);
  29154. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  29155. }
  29156. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  29157. {
  29158. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  29159. }
  29160. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  29161. {
  29162. $command = $this->getCommand($svnCommand, $url, $path);
  29163. $output = null;
  29164. $io = $this->io;
  29165. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  29166. if ($type !== 'out') {
  29167. return;
  29168. }
  29169. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  29170. return;
  29171. }
  29172. $output .= $buffer;
  29173. if ($verbose) {
  29174. $io->writeError($buffer, false);
  29175. }
  29176. };
  29177. $status = $this->process->execute($command, $handler, $cwd);
  29178. if (0 === $status) {
  29179. return $output;
  29180. }
  29181. $errorOutput = $this->process->getErrorOutput();
  29182. $fullOutput = implode("\n", array($output, $errorOutput));
  29183. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  29184. && false === stripos($fullOutput, 'authorization failed')
  29185. && false === stripos($fullOutput, 'svn: E170001:')
  29186. && false === stripos($fullOutput, 'svn: E215004:')) {
  29187. throw new \RuntimeException($fullOutput);
  29188. }
  29189. if (!$this->hasAuth()) {
  29190. $this->doAuthDance();
  29191. }
  29192. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  29193. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  29194. }
  29195. throw new \RuntimeException(
  29196. 'wrong credentials provided ('.$fullOutput.')'
  29197. );
  29198. }
  29199. public function setCacheCredentials($cacheCredentials)
  29200. {
  29201. $this->cacheCredentials = $cacheCredentials;
  29202. }
  29203. protected function doAuthDance()
  29204. {
  29205. if (!$this->io->isInteractive()) {
  29206. throw new \RuntimeException(
  29207. 'can not ask for authentication in non interactive mode'
  29208. );
  29209. }
  29210. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  29211. $this->hasAuth = true;
  29212. $this->credentials['username'] = $this->io->ask("Username: ");
  29213. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  29214. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  29215. return $this;
  29216. }
  29217. protected function getCommand($cmd, $url, $path = null)
  29218. {
  29219. $cmd = sprintf(
  29220. '%s %s%s %s',
  29221. $cmd,
  29222. '--non-interactive ',
  29223. $this->getCredentialString(),
  29224. ProcessExecutor::escape($url)
  29225. );
  29226. if ($path) {
  29227. $cmd .= ' ' . ProcessExecutor::escape($path);
  29228. }
  29229. return $cmd;
  29230. }
  29231. protected function getCredentialString()
  29232. {
  29233. if (!$this->hasAuth()) {
  29234. return '';
  29235. }
  29236. return sprintf(
  29237. ' %s--username %s --password %s ',
  29238. $this->getAuthCache(),
  29239. ProcessExecutor::escape($this->getUsername()),
  29240. ProcessExecutor::escape($this->getPassword())
  29241. );
  29242. }
  29243. protected function getPassword()
  29244. {
  29245. if ($this->credentials === null) {
  29246. throw new \LogicException("No svn auth detected.");
  29247. }
  29248. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  29249. }
  29250. protected function getUsername()
  29251. {
  29252. if ($this->credentials === null) {
  29253. throw new \LogicException("No svn auth detected.");
  29254. }
  29255. return $this->credentials['username'];
  29256. }
  29257. protected function hasAuth()
  29258. {
  29259. if (null !== $this->hasAuth) {
  29260. return $this->hasAuth;
  29261. }
  29262. if (false === $this->createAuthFromConfig()) {
  29263. $this->createAuthFromUrl();
  29264. }
  29265. return $this->hasAuth;
  29266. }
  29267. protected function getAuthCache()
  29268. {
  29269. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  29270. }
  29271. private function createAuthFromConfig()
  29272. {
  29273. if (!$this->config->has('http-basic')) {
  29274. return $this->hasAuth = false;
  29275. }
  29276. $authConfig = $this->config->get('http-basic');
  29277. $host = parse_url($this->url, PHP_URL_HOST);
  29278. if (isset($authConfig[$host])) {
  29279. $this->credentials['username'] = $authConfig[$host]['username'];
  29280. $this->credentials['password'] = $authConfig[$host]['password'];
  29281. return $this->hasAuth = true;
  29282. }
  29283. return $this->hasAuth = false;
  29284. }
  29285. private function createAuthFromUrl()
  29286. {
  29287. $uri = parse_url($this->url);
  29288. if (empty($uri['user'])) {
  29289. return $this->hasAuth = false;
  29290. }
  29291. $this->credentials['username'] = $uri['user'];
  29292. if (!empty($uri['pass'])) {
  29293. $this->credentials['password'] = $uri['pass'];
  29294. }
  29295. return $this->hasAuth = true;
  29296. }
  29297. public function binaryVersion()
  29298. {
  29299. if (!self::$version) {
  29300. if (0 === $this->process->execute('svn --version', $output)) {
  29301. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  29302. self::$version = $match[1];
  29303. }
  29304. }
  29305. }
  29306. return self::$version;
  29307. }
  29308. }
  29309. <?php
  29310. namespace Composer\Util;
  29311. use Composer\CaBundle\CaBundle;
  29312. final class TlsHelper
  29313. {
  29314. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  29315. {
  29316. $names = self::getCertificateNames($certificate);
  29317. if (empty($names)) {
  29318. return false;
  29319. }
  29320. $combinedNames = array_merge($names['san'], array($names['cn']));
  29321. $hostname = strtolower($hostname);
  29322. foreach ($combinedNames as $certName) {
  29323. $matcher = self::certNameMatcher($certName);
  29324. if ($matcher && $matcher($hostname)) {
  29325. $cn = $names['cn'];
  29326. return true;
  29327. }
  29328. }
  29329. return false;
  29330. }
  29331. public static function getCertificateNames($certificate)
  29332. {
  29333. if (is_array($certificate)) {
  29334. $info = $certificate;
  29335. } elseif (CaBundle::isOpensslParseSafe()) {
  29336. $info = openssl_x509_parse($certificate, false);
  29337. }
  29338. if (!isset($info['subject']['commonName'])) {
  29339. return null;
  29340. }
  29341. $commonName = strtolower($info['subject']['commonName']);
  29342. $subjectAltNames = array();
  29343. if (isset($info['extensions']['subjectAltName'])) {
  29344. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  29345. $subjectAltNames = array_filter(array_map(function ($name) {
  29346. if (0 === strpos($name, 'DNS:')) {
  29347. return strtolower(ltrim(substr($name, 4)));
  29348. }
  29349. return null;
  29350. }, $subjectAltNames));
  29351. $subjectAltNames = array_values($subjectAltNames);
  29352. }
  29353. return array(
  29354. 'cn' => $commonName,
  29355. 'san' => $subjectAltNames,
  29356. );
  29357. }
  29358. public static function getCertificateFingerprint($certificate)
  29359. {
  29360. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  29361. $pubkeypem = $pubkeydetails['key'];
  29362. $start = '-----BEGIN PUBLIC KEY-----';
  29363. $end = '-----END PUBLIC KEY-----';
  29364. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  29365. $der = base64_decode($pemtrim);
  29366. return sha1($der);
  29367. }
  29368. public static function isOpensslParseSafe()
  29369. {
  29370. return CaBundle::isOpensslParseSafe();
  29371. }
  29372. private static function certNameMatcher($certName)
  29373. {
  29374. $wildcards = substr_count($certName, '*');
  29375. if (0 === $wildcards) {
  29376. return function ($hostname) use ($certName) {
  29377. return $hostname === $certName;
  29378. };
  29379. }
  29380. if (1 === $wildcards) {
  29381. $components = explode('.', $certName);
  29382. if (3 > count($components)) {
  29383. return;
  29384. }
  29385. $firstComponent = $components[0];
  29386. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  29387. return;
  29388. }
  29389. $wildcardRegex = preg_quote($certName);
  29390. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  29391. $wildcardRegex = "{^{$wildcardRegex}$}";
  29392. return function ($hostname) use ($wildcardRegex) {
  29393. return 1 === preg_match($wildcardRegex, $hostname);
  29394. };
  29395. }
  29396. }
  29397. }
  29398. <?php
  29399. namespace Composer\Util;
  29400. use Composer\Config;
  29401. class Url
  29402. {
  29403. public static function updateDistReference(Config $config, $url, $ref)
  29404. {
  29405. $host = parse_url($url, PHP_URL_HOST);
  29406. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  29407. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  29408. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29409. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  29410. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29411. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  29412. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29413. }
  29414. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  29415. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  29416. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  29417. }
  29418. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  29419. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  29420. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  29421. }
  29422. } elseif (in_array($host, $config->get('github-domains'), true)) {
  29423. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  29424. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  29425. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  29426. }
  29427. return $url;
  29428. }
  29429. }
  29430. <?php
  29431. namespace Composer\Util;
  29432. class Zip
  29433. {
  29434. public static function getComposerJson($pathToZip)
  29435. {
  29436. if (!extension_loaded('zip')) {
  29437. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  29438. }
  29439. $zip = new \ZipArchive();
  29440. if ($zip->open($pathToZip) !== true) {
  29441. return null;
  29442. }
  29443. if (0 == $zip->numFiles) {
  29444. $zip->close();
  29445. return null;
  29446. }
  29447. $foundFileIndex = self::locateFile($zip, 'composer.json');
  29448. if (false === $foundFileIndex) {
  29449. $zip->close();
  29450. return null;
  29451. }
  29452. $content = null;
  29453. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  29454. $stream = $zip->getStream($configurationFileName);
  29455. if (false !== $stream) {
  29456. $content = stream_get_contents($stream);
  29457. }
  29458. $zip->close();
  29459. return $content;
  29460. }
  29461. private static function locateFile(\ZipArchive $zip, $filename)
  29462. {
  29463. $indexOfShortestMatch = false;
  29464. $lengthOfShortestMatch = -1;
  29465. for ($i = 0; $i < $zip->numFiles; $i++) {
  29466. $stat = $zip->statIndex($i);
  29467. if (strcmp(basename($stat['name']), $filename) === 0) {
  29468. $directoryName = dirname($stat['name']);
  29469. if ($directoryName === '.') {
  29470. return $i;
  29471. }
  29472. if (strpos($directoryName, '\\') !== false ||
  29473. strpos($directoryName, '/') !== false) {
  29474. continue;
  29475. }
  29476. $length = strlen($stat['name']);
  29477. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  29478. $contents = $zip->getFromIndex($i);
  29479. if ($contents !== false) {
  29480. $indexOfShortestMatch = $i;
  29481. $lengthOfShortestMatch = $length;
  29482. }
  29483. }
  29484. }
  29485. }
  29486. return $indexOfShortestMatch;
  29487. }
  29488. }
  29489. <?php
  29490. namespace Composer;
  29491. use Symfony\Component\Console\Output\OutputInterface;
  29492. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  29493. class XdebugHandler extends XdebugHandler\XdebugHandler
  29494. {
  29495. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  29496. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  29497. public function __construct(OutputInterface $output)
  29498. {
  29499. parent::__construct('composer', '--ansi');
  29500. }
  29501. }
  29502. <?php
  29503. function includeIfExists($file)
  29504. {
  29505. return file_exists($file) ? include $file : false;
  29506. }
  29507. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  29508. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  29509. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  29510. exit(1);
  29511. }
  29512. return $loader;
  29513. <?php
  29514. /*
  29515. * This file is part of Composer.
  29516. *
  29517. * (c) Nils Adermann <naderman@naderman.de>
  29518. * Jordi Boggiano <j.boggiano@seld.be>
  29519. *
  29520. * For the full copyright and license information, please view the LICENSE
  29521. * file that was distributed with this source code.
  29522. */
  29523. namespace Composer\Autoload;
  29524. /**
  29525. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  29526. *
  29527. * $loader = new \Composer\Autoload\ClassLoader();
  29528. *
  29529. * // register classes with namespaces
  29530. * $loader->add('Symfony\Component', __DIR__.'/component');
  29531. * $loader->add('Symfony', __DIR__.'/framework');
  29532. *
  29533. * // activate the autoloader
  29534. * $loader->register();
  29535. *
  29536. * // to enable searching the include path (eg. for PEAR packages)
  29537. * $loader->setUseIncludePath(true);
  29538. *
  29539. * In this example, if you try to use a class in the Symfony\Component
  29540. * namespace or one of its children (Symfony\Component\Console for instance),
  29541. * the autoloader will first look for the class under the component/
  29542. * directory, and it will then fallback to the framework/ directory if not
  29543. * found before giving up.
  29544. *
  29545. * This class is loosely based on the Symfony UniversalClassLoader.
  29546. *
  29547. * @author Fabien Potencier <fabien@symfony.com>
  29548. * @author Jordi Boggiano <j.boggiano@seld.be>
  29549. * @see http://www.php-fig.org/psr/psr-0/
  29550. * @see http://www.php-fig.org/psr/psr-4/
  29551. */
  29552. class ClassLoader
  29553. {
  29554. // PSR-4
  29555. private $prefixLengthsPsr4 = array();
  29556. private $prefixDirsPsr4 = array();
  29557. private $fallbackDirsPsr4 = array();
  29558. // PSR-0
  29559. private $prefixesPsr0 = array();
  29560. private $fallbackDirsPsr0 = array();
  29561. private $useIncludePath = false;
  29562. private $classMap = array();
  29563. private $classMapAuthoritative = false;
  29564. private $missingClasses = array();
  29565. private $apcuPrefix;
  29566. public function getPrefixes()
  29567. {
  29568. if (!empty($this->prefixesPsr0)) {
  29569. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  29570. }
  29571. return array();
  29572. }
  29573. public function getPrefixesPsr4()
  29574. {
  29575. return $this->prefixDirsPsr4;
  29576. }
  29577. public function getFallbackDirs()
  29578. {
  29579. return $this->fallbackDirsPsr0;
  29580. }
  29581. public function getFallbackDirsPsr4()
  29582. {
  29583. return $this->fallbackDirsPsr4;
  29584. }
  29585. public function getClassMap()
  29586. {
  29587. return $this->classMap;
  29588. }
  29589. /**
  29590. * @param array $classMap Class to filename map
  29591. */
  29592. public function addClassMap(array $classMap)
  29593. {
  29594. if ($this->classMap) {
  29595. $this->classMap = array_merge($this->classMap, $classMap);
  29596. } else {
  29597. $this->classMap = $classMap;
  29598. }
  29599. }
  29600. /**
  29601. * Registers a set of PSR-0 directories for a given prefix, either
  29602. * appending or prepending to the ones previously set for this prefix.
  29603. *
  29604. * @param string $prefix The prefix
  29605. * @param array|string $paths The PSR-0 root directories
  29606. * @param bool $prepend Whether to prepend the directories
  29607. */
  29608. public function add($prefix, $paths, $prepend = false)
  29609. {
  29610. if (!$prefix) {
  29611. if ($prepend) {
  29612. $this->fallbackDirsPsr0 = array_merge(
  29613. (array) $paths,
  29614. $this->fallbackDirsPsr0
  29615. );
  29616. } else {
  29617. $this->fallbackDirsPsr0 = array_merge(
  29618. $this->fallbackDirsPsr0,
  29619. (array) $paths
  29620. );
  29621. }
  29622. return;
  29623. }
  29624. $first = $prefix[0];
  29625. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  29626. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  29627. return;
  29628. }
  29629. if ($prepend) {
  29630. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29631. (array) $paths,
  29632. $this->prefixesPsr0[$first][$prefix]
  29633. );
  29634. } else {
  29635. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29636. $this->prefixesPsr0[$first][$prefix],
  29637. (array) $paths
  29638. );
  29639. }
  29640. }
  29641. /**
  29642. * Registers a set of PSR-4 directories for a given namespace, either
  29643. * appending or prepending to the ones previously set for this namespace.
  29644. *
  29645. * @param string $prefix The prefix/namespace, with trailing '\\'
  29646. * @param array|string $paths The PSR-4 base directories
  29647. * @param bool $prepend Whether to prepend the directories
  29648. *
  29649. * @throws \InvalidArgumentException
  29650. */
  29651. public function addPsr4($prefix, $paths, $prepend = false)
  29652. {
  29653. if (!$prefix) {
  29654. // Register directories for the root namespace.
  29655. if ($prepend) {
  29656. $this->fallbackDirsPsr4 = array_merge(
  29657. (array) $paths,
  29658. $this->fallbackDirsPsr4
  29659. );
  29660. } else {
  29661. $this->fallbackDirsPsr4 = array_merge(
  29662. $this->fallbackDirsPsr4,
  29663. (array) $paths
  29664. );
  29665. }
  29666. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  29667. // Register directories for a new namespace.
  29668. $length = strlen($prefix);
  29669. if ('\\' !== $prefix[$length - 1]) {
  29670. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29671. }
  29672. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29673. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29674. } elseif ($prepend) {
  29675. // Prepend directories for an already registered namespace.
  29676. $this->prefixDirsPsr4[$prefix] = array_merge(
  29677. (array) $paths,
  29678. $this->prefixDirsPsr4[$prefix]
  29679. );
  29680. } else {
  29681. // Append directories for an already registered namespace.
  29682. $this->prefixDirsPsr4[$prefix] = array_merge(
  29683. $this->prefixDirsPsr4[$prefix],
  29684. (array) $paths
  29685. );
  29686. }
  29687. }
  29688. /**
  29689. * Registers a set of PSR-0 directories for a given prefix,
  29690. * replacing any others previously set for this prefix.
  29691. *
  29692. * @param string $prefix The prefix
  29693. * @param array|string $paths The PSR-0 base directories
  29694. */
  29695. public function set($prefix, $paths)
  29696. {
  29697. if (!$prefix) {
  29698. $this->fallbackDirsPsr0 = (array) $paths;
  29699. } else {
  29700. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  29701. }
  29702. }
  29703. /**
  29704. * Registers a set of PSR-4 directories for a given namespace,
  29705. * replacing any others previously set for this namespace.
  29706. *
  29707. * @param string $prefix The prefix/namespace, with trailing '\\'
  29708. * @param array|string $paths The PSR-4 base directories
  29709. *
  29710. * @throws \InvalidArgumentException
  29711. */
  29712. public function setPsr4($prefix, $paths)
  29713. {
  29714. if (!$prefix) {
  29715. $this->fallbackDirsPsr4 = (array) $paths;
  29716. } else {
  29717. $length = strlen($prefix);
  29718. if ('\\' !== $prefix[$length - 1]) {
  29719. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29720. }
  29721. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29722. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29723. }
  29724. }
  29725. /**
  29726. * Turns on searching the include path for class files.
  29727. *
  29728. * @param bool $useIncludePath
  29729. */
  29730. public function setUseIncludePath($useIncludePath)
  29731. {
  29732. $this->useIncludePath = $useIncludePath;
  29733. }
  29734. /**
  29735. * Can be used to check if the autoloader uses the include path to check
  29736. * for classes.
  29737. *
  29738. * @return bool
  29739. */
  29740. public function getUseIncludePath()
  29741. {
  29742. return $this->useIncludePath;
  29743. }
  29744. /**
  29745. * Turns off searching the prefix and fallback directories for classes
  29746. * that have not been registered with the class map.
  29747. *
  29748. * @param bool $classMapAuthoritative
  29749. */
  29750. public function setClassMapAuthoritative($classMapAuthoritative)
  29751. {
  29752. $this->classMapAuthoritative = $classMapAuthoritative;
  29753. }
  29754. /**
  29755. * Should class lookup fail if not found in the current class map?
  29756. *
  29757. * @return bool
  29758. */
  29759. public function isClassMapAuthoritative()
  29760. {
  29761. return $this->classMapAuthoritative;
  29762. }
  29763. /**
  29764. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  29765. *
  29766. * @param string|null $apcuPrefix
  29767. */
  29768. public function setApcuPrefix($apcuPrefix)
  29769. {
  29770. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  29771. }
  29772. /**
  29773. * The APCu prefix in use, or null if APCu caching is not enabled.
  29774. *
  29775. * @return string|null
  29776. */
  29777. public function getApcuPrefix()
  29778. {
  29779. return $this->apcuPrefix;
  29780. }
  29781. /**
  29782. * Registers this instance as an autoloader.
  29783. *
  29784. * @param bool $prepend Whether to prepend the autoloader or not
  29785. */
  29786. public function register($prepend = false)
  29787. {
  29788. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  29789. }
  29790. /**
  29791. * Unregisters this instance as an autoloader.
  29792. */
  29793. public function unregister()
  29794. {
  29795. spl_autoload_unregister(array($this, 'loadClass'));
  29796. }
  29797. /**
  29798. * Loads the given class or interface.
  29799. *
  29800. * @param string $class The name of the class
  29801. * @return bool|null True if loaded, null otherwise
  29802. */
  29803. public function loadClass($class)
  29804. {
  29805. if ($file = $this->findFile($class)) {
  29806. includeFile($file);
  29807. return true;
  29808. }
  29809. }
  29810. /**
  29811. * Finds the path to the file where the class is defined.
  29812. *
  29813. * @param string $class The name of the class
  29814. *
  29815. * @return string|false The path if found, false otherwise
  29816. */
  29817. public function findFile($class)
  29818. {
  29819. // class map lookup
  29820. if (isset($this->classMap[$class])) {
  29821. return $this->classMap[$class];
  29822. }
  29823. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  29824. return false;
  29825. }
  29826. if (null !== $this->apcuPrefix) {
  29827. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  29828. if ($hit) {
  29829. return $file;
  29830. }
  29831. }
  29832. $file = $this->findFileWithExtension($class, '.php');
  29833. // Search for Hack files if we are running on HHVM
  29834. if (false === $file && defined('HHVM_VERSION')) {
  29835. $file = $this->findFileWithExtension($class, '.hh');
  29836. }
  29837. if (null !== $this->apcuPrefix) {
  29838. apcu_add($this->apcuPrefix.$class, $file);
  29839. }
  29840. if (false === $file) {
  29841. // Remember that this class does not exist.
  29842. $this->missingClasses[$class] = true;
  29843. }
  29844. return $file;
  29845. }
  29846. private function findFileWithExtension($class, $ext)
  29847. {
  29848. // PSR-4 lookup
  29849. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  29850. $first = $class[0];
  29851. if (isset($this->prefixLengthsPsr4[$first])) {
  29852. $subPath = $class;
  29853. while (false !== $lastPos = strrpos($subPath, '\\')) {
  29854. $subPath = substr($subPath, 0, $lastPos);
  29855. $search = $subPath . '\\';
  29856. if (isset($this->prefixDirsPsr4[$search])) {
  29857. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  29858. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  29859. if (file_exists($file = $dir . $pathEnd)) {
  29860. return $file;
  29861. }
  29862. }
  29863. }
  29864. }
  29865. }
  29866. // PSR-4 fallback dirs
  29867. foreach ($this->fallbackDirsPsr4 as $dir) {
  29868. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  29869. return $file;
  29870. }
  29871. }
  29872. // PSR-0 lookup
  29873. if (false !== $pos = strrpos($class, '\\')) {
  29874. // namespaced class name
  29875. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  29876. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  29877. } else {
  29878. // PEAR-like class name
  29879. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  29880. }
  29881. if (isset($this->prefixesPsr0[$first])) {
  29882. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  29883. if (0 === strpos($class, $prefix)) {
  29884. foreach ($dirs as $dir) {
  29885. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29886. return $file;
  29887. }
  29888. }
  29889. }
  29890. }
  29891. }
  29892. // PSR-0 fallback dirs
  29893. foreach ($this->fallbackDirsPsr0 as $dir) {
  29894. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29895. return $file;
  29896. }
  29897. }
  29898. // PSR-0 include paths.
  29899. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  29900. return $file;
  29901. }
  29902. return false;
  29903. }
  29904. }
  29905. /**
  29906. * Scope isolated include.
  29907. *
  29908. * Prevents access to $this/self from included files.
  29909. */
  29910. function includeFile($file)
  29911. {
  29912. include $file;
  29913. }
  29914. {
  29915. "$schema": "http://json-schema.org/draft-04/schema#",
  29916. "description": "A representation of packages metadata.",
  29917. "type": "object",
  29918. "oneOf": [
  29919. { "required": [ "packages" ] },
  29920. { "required": [ "providers" ] },
  29921. { "required": [ "provider-includes", "providers-url" ] }
  29922. ],
  29923. "properties": {
  29924. "packages": {
  29925. "type": ["object", "array"],
  29926. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29927. "additionalProperties": { "$ref": "#/definitions/versions" }
  29928. },
  29929. "providers-url": {
  29930. "type": "string",
  29931. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  29932. },
  29933. "provider-includes": {
  29934. "type": "object",
  29935. "description": "A hashmap of provider listings.",
  29936. "additionalProperties": { "$ref": "#/definitions/provider" }
  29937. },
  29938. "providers": {
  29939. "type": "object",
  29940. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29941. "additionalProperties": { "$ref": "#/definitions/provider" }
  29942. },
  29943. "notify-batch": {
  29944. "type": "string",
  29945. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  29946. },
  29947. "search": {
  29948. "type": "string",
  29949. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  29950. },
  29951. "warning": {
  29952. "type": "string",
  29953. "description": "A message that will be output by Composer as a warning when this source is consulted."
  29954. }
  29955. },
  29956. "definitions": {
  29957. "versions": {
  29958. "type": "object",
  29959. "description": "A hashmap of versions and their metadata.",
  29960. "additionalProperties": { "$ref": "#/definitions/version" }
  29961. },
  29962. "version": {
  29963. "type": "object",
  29964. "oneOf": [
  29965. { "$ref": "#/definitions/package" },
  29966. { "$ref": "#/definitions/metapackage" }
  29967. ]
  29968. },
  29969. "package-base": {
  29970. "properties": {
  29971. "name": { "type": "string" },
  29972. "type": { "type": "string" },
  29973. "version": { "type": "string" },
  29974. "version_normalized": {
  29975. "type": "string",
  29976. "description": "Normalized version, optional but can save computational time on client side."
  29977. },
  29978. "autoload": { "type": "object" },
  29979. "require": { "type": "object" },
  29980. "replace": { "type": "object" },
  29981. "conflict": { "type": "object" },
  29982. "provide": { "type": "object" },
  29983. "time": { "type": "string" }
  29984. },
  29985. "additionalProperties": true
  29986. },
  29987. "package": {
  29988. "allOf": [
  29989. { "$ref": "#/definitions/package-base" },
  29990. {
  29991. "properties": {
  29992. "dist": { "type": "object" },
  29993. "source": { "type": "object" }
  29994. }
  29995. },
  29996. { "oneOf": [
  29997. { "required": [ "name", "version", "source" ] },
  29998. { "required": [ "name", "version", "dist" ] }
  29999. ] }
  30000. ]
  30001. },
  30002. "metapackage": {
  30003. "allOf": [
  30004. { "$ref": "#/definitions/package-base" },
  30005. {
  30006. "properties": {
  30007. "type": { "type": "string", "enum": [ "metapackage" ] }
  30008. },
  30009. "required": [ "name", "version", "type" ]
  30010. }
  30011. ]
  30012. },
  30013. "provider": {
  30014. "type": "object",
  30015. "properties": {
  30016. "sha256": {
  30017. "type": "string",
  30018. "description": "Hash value that can be used to validate the resource."
  30019. }
  30020. }
  30021. }
  30022. }
  30023. }
  30024. {
  30025. "$schema": "http://json-schema.org/draft-04/schema#",
  30026. "name": "Package",
  30027. "type": "object",
  30028. "additionalProperties": false,
  30029. "required": [ "name", "description" ],
  30030. "properties": {
  30031. "name": {
  30032. "type": "string",
  30033. "description": "Package name, including 'vendor-name/' prefix."
  30034. },
  30035. "type": {
  30036. "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.",
  30037. "type": "string",
  30038. "pattern": "^[a-z0-9-]+$"
  30039. },
  30040. "target-dir": {
  30041. "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.",
  30042. "type": "string"
  30043. },
  30044. "description": {
  30045. "type": "string",
  30046. "description": "Short package description."
  30047. },
  30048. "keywords": {
  30049. "type": "array",
  30050. "items": {
  30051. "type": "string",
  30052. "description": "A tag/keyword that this package relates to."
  30053. }
  30054. },
  30055. "homepage": {
  30056. "type": "string",
  30057. "description": "Homepage URL for the project.",
  30058. "format": "uri"
  30059. },
  30060. "readme": {
  30061. "type": "string",
  30062. "description": "Relative path to the readme document."
  30063. },
  30064. "version": {
  30065. "type": "string",
  30066. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  30067. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?|^dev-"
  30068. },
  30069. "time": {
  30070. "type": "string",
  30071. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  30072. },
  30073. "license": {
  30074. "type": ["string", "array"],
  30075. "description": "License name. Or an array of license names."
  30076. },
  30077. "authors": {
  30078. "$ref": "#/definitions/authors"
  30079. },
  30080. "require": {
  30081. "type": "object",
  30082. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  30083. "additionalProperties": {
  30084. "type": "string"
  30085. }
  30086. },
  30087. "replace": {
  30088. "type": "object",
  30089. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  30090. "additionalProperties": {
  30091. "type": "string"
  30092. }
  30093. },
  30094. "conflict": {
  30095. "type": "object",
  30096. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  30097. "additionalProperties": {
  30098. "type": "string"
  30099. }
  30100. },
  30101. "provide": {
  30102. "type": "object",
  30103. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  30104. "additionalProperties": {
  30105. "type": "string"
  30106. }
  30107. },
  30108. "require-dev": {
  30109. "type": "object",
  30110. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  30111. "additionalProperties": {
  30112. "type": "string"
  30113. }
  30114. },
  30115. "suggest": {
  30116. "type": "object",
  30117. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  30118. "additionalProperties": {
  30119. "type": "string"
  30120. }
  30121. },
  30122. "config": {
  30123. "type": "object",
  30124. "description": "Composer options.",
  30125. "properties": {
  30126. "process-timeout": {
  30127. "type": "integer",
  30128. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  30129. },
  30130. "use-include-path": {
  30131. "type": "boolean",
  30132. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  30133. },
  30134. "preferred-install": {
  30135. "type": ["string", "object"],
  30136. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  30137. },
  30138. "notify-on-install": {
  30139. "type": "boolean",
  30140. "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."
  30141. },
  30142. "github-protocols": {
  30143. "type": "array",
  30144. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  30145. "items": {
  30146. "type": "string"
  30147. }
  30148. },
  30149. "github-oauth": {
  30150. "type": "object",
  30151. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  30152. "additionalProperties": {
  30153. "type": "string"
  30154. }
  30155. },
  30156. "gitlab-oauth": {
  30157. "type": "object",
  30158. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30159. "additionalProperties": {
  30160. "type": "string"
  30161. }
  30162. },
  30163. "gitlab-token": {
  30164. "type": "object",
  30165. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30166. "additionalProperties": {
  30167. "type": "string"
  30168. }
  30169. },
  30170. "bearer": {
  30171. "type": "object",
  30172. "description": "A hash of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  30173. "additionalProperties": {
  30174. "type": "string"
  30175. }
  30176. },
  30177. "disable-tls": {
  30178. "type": "boolean",
  30179. "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."
  30180. },
  30181. "secure-http": {
  30182. "type": "boolean",
  30183. "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."
  30184. },
  30185. "cafile": {
  30186. "type": "string",
  30187. "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."
  30188. },
  30189. "capath": {
  30190. "type": "string",
  30191. "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."
  30192. },
  30193. "http-basic": {
  30194. "type": "object",
  30195. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  30196. "additionalProperties": {
  30197. "type": "object",
  30198. "required": ["username", "password"],
  30199. "properties": {
  30200. "username": {
  30201. "type": "string",
  30202. "description": "The username used for HTTP Basic authentication"
  30203. },
  30204. "password": {
  30205. "type": "string",
  30206. "description": "The password used for HTTP Basic authentication"
  30207. }
  30208. }
  30209. }
  30210. },
  30211. "store-auths": {
  30212. "type": ["string", "boolean"],
  30213. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  30214. },
  30215. "platform": {
  30216. "type": "object",
  30217. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  30218. "additionalProperties": {
  30219. "type": "string"
  30220. }
  30221. },
  30222. "vendor-dir": {
  30223. "type": "string",
  30224. "description": "The location where all packages are installed, defaults to \"vendor\"."
  30225. },
  30226. "bin-dir": {
  30227. "type": "string",
  30228. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  30229. },
  30230. "data-dir": {
  30231. "type": "string",
  30232. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  30233. },
  30234. "cache-dir": {
  30235. "type": "string",
  30236. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  30237. },
  30238. "cache-files-dir": {
  30239. "type": "string",
  30240. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  30241. },
  30242. "cache-repo-dir": {
  30243. "type": "string",
  30244. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  30245. },
  30246. "cache-vcs-dir": {
  30247. "type": "string",
  30248. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  30249. },
  30250. "cache-ttl": {
  30251. "type": "integer",
  30252. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  30253. },
  30254. "cache-files-ttl": {
  30255. "type": "integer",
  30256. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  30257. },
  30258. "cache-files-maxsize": {
  30259. "type": ["string", "integer"],
  30260. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  30261. },
  30262. "bin-compat": {
  30263. "enum": ["auto", "full"],
  30264. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  30265. },
  30266. "discard-changes": {
  30267. "type": ["string", "boolean"],
  30268. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  30269. },
  30270. "autoloader-suffix": {
  30271. "type": "string",
  30272. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  30273. },
  30274. "optimize-autoloader": {
  30275. "type": "boolean",
  30276. "description": "Always optimize when dumping the autoloader."
  30277. },
  30278. "prepend-autoloader": {
  30279. "type": "boolean",
  30280. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  30281. },
  30282. "classmap-authoritative": {
  30283. "type": "boolean",
  30284. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  30285. },
  30286. "apcu-autoloader": {
  30287. "type": "boolean",
  30288. "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."
  30289. },
  30290. "github-domains": {
  30291. "type": "array",
  30292. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  30293. "items": {
  30294. "type": "string"
  30295. }
  30296. },
  30297. "github-expose-hostname": {
  30298. "type": "boolean",
  30299. "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."
  30300. },
  30301. "gitlab-domains": {
  30302. "type": "array",
  30303. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  30304. "items": {
  30305. "type": "string"
  30306. }
  30307. },
  30308. "use-github-api": {
  30309. "type": "boolean",
  30310. "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."
  30311. },
  30312. "archive-format": {
  30313. "type": "string",
  30314. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  30315. },
  30316. "archive-dir": {
  30317. "type": "string",
  30318. "description": "The default archive path when not provided on cli, defaults to \".\"."
  30319. },
  30320. "htaccess-protect": {
  30321. "type": "boolean",
  30322. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  30323. },
  30324. "sort-packages": {
  30325. "type": "boolean",
  30326. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  30327. },
  30328. "lock": {
  30329. "type": "boolean",
  30330. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  30331. }
  30332. }
  30333. },
  30334. "extra": {
  30335. "type": ["object", "array"],
  30336. "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.",
  30337. "additionalProperties": true
  30338. },
  30339. "autoload": {
  30340. "$ref": "#/definitions/autoload"
  30341. },
  30342. "autoload-dev": {
  30343. "type": "object",
  30344. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  30345. "properties": {
  30346. "psr-0": {
  30347. "type": "object",
  30348. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  30349. "additionalProperties": {
  30350. "type": ["string", "array"],
  30351. "items": {
  30352. "type": "string"
  30353. }
  30354. }
  30355. },
  30356. "psr-4": {
  30357. "type": "object",
  30358. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30359. "additionalProperties": {
  30360. "type": ["string", "array"],
  30361. "items": {
  30362. "type": "string"
  30363. }
  30364. }
  30365. },
  30366. "classmap": {
  30367. "type": "array",
  30368. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30369. },
  30370. "files": {
  30371. "type": "array",
  30372. "description": "This is an array of files that are always required on every request."
  30373. }
  30374. }
  30375. },
  30376. "archive": {
  30377. "type": ["object"],
  30378. "description": "Options for creating package archives for distribution.",
  30379. "properties": {
  30380. "exclude": {
  30381. "type": "array",
  30382. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  30383. }
  30384. }
  30385. },
  30386. "repositories": {
  30387. "type": ["object", "array"],
  30388. "description": "A set of additional repositories where packages can be found.",
  30389. "additionalProperties": {
  30390. "oneOf": [
  30391. { "$ref": "#/definitions/repository" },
  30392. { "type": "boolean", "enum": [false] }
  30393. ]
  30394. },
  30395. "items": {
  30396. "oneOf": [
  30397. { "$ref": "#/definitions/repository" },
  30398. {
  30399. "type": "object",
  30400. "additionalProperties": { "type": "boolean", "enum": [false] },
  30401. "minProperties": 1,
  30402. "maxProperties": 1
  30403. }
  30404. ]
  30405. }
  30406. },
  30407. "minimum-stability": {
  30408. "type": ["string"],
  30409. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  30410. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  30411. },
  30412. "prefer-stable": {
  30413. "type": ["boolean"],
  30414. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  30415. },
  30416. "bin": {
  30417. "type": ["string", "array"],
  30418. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30419. "items": {
  30420. "type": "string"
  30421. }
  30422. },
  30423. "include-path": {
  30424. "type": ["array"],
  30425. "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.",
  30426. "items": {
  30427. "type": "string"
  30428. }
  30429. },
  30430. "scripts": {
  30431. "type": ["object"],
  30432. "description": "Script listeners that will be executed before/after some events.",
  30433. "properties": {
  30434. "pre-install-cmd": {
  30435. "type": ["array", "string"],
  30436. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  30437. },
  30438. "post-install-cmd": {
  30439. "type": ["array", "string"],
  30440. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  30441. },
  30442. "pre-update-cmd": {
  30443. "type": ["array", "string"],
  30444. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  30445. },
  30446. "post-update-cmd": {
  30447. "type": ["array", "string"],
  30448. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  30449. },
  30450. "pre-status-cmd": {
  30451. "type": ["array", "string"],
  30452. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  30453. },
  30454. "post-status-cmd": {
  30455. "type": ["array", "string"],
  30456. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  30457. },
  30458. "pre-package-install": {
  30459. "type": ["array", "string"],
  30460. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  30461. },
  30462. "post-package-install": {
  30463. "type": ["array", "string"],
  30464. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  30465. },
  30466. "pre-package-update": {
  30467. "type": ["array", "string"],
  30468. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  30469. },
  30470. "post-package-update": {
  30471. "type": ["array", "string"],
  30472. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  30473. },
  30474. "pre-package-uninstall": {
  30475. "type": ["array", "string"],
  30476. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30477. },
  30478. "post-package-uninstall": {
  30479. "type": ["array", "string"],
  30480. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30481. },
  30482. "pre-autoload-dump": {
  30483. "type": ["array", "string"],
  30484. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30485. },
  30486. "post-autoload-dump": {
  30487. "type": ["array", "string"],
  30488. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30489. },
  30490. "post-root-package-install": {
  30491. "type": ["array", "string"],
  30492. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  30493. },
  30494. "post-create-project-cmd": {
  30495. "type": ["array", "string"],
  30496. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  30497. }
  30498. }
  30499. },
  30500. "scripts-descriptions": {
  30501. "type": ["object"],
  30502. "description": "Descriptions for custom commands, shown in console help.",
  30503. "additionalProperties": {
  30504. "type": "string"
  30505. }
  30506. },
  30507. "support": {
  30508. "type": "object",
  30509. "properties": {
  30510. "email": {
  30511. "type": "string",
  30512. "description": "Email address for support.",
  30513. "format": "email"
  30514. },
  30515. "issues": {
  30516. "type": "string",
  30517. "description": "URL to the issue tracker.",
  30518. "format": "uri"
  30519. },
  30520. "forum": {
  30521. "type": "string",
  30522. "description": "URL to the forum.",
  30523. "format": "uri"
  30524. },
  30525. "wiki": {
  30526. "type": "string",
  30527. "description": "URL to the wiki.",
  30528. "format": "uri"
  30529. },
  30530. "irc": {
  30531. "type": "string",
  30532. "description": "IRC channel for support, as irc://server/channel.",
  30533. "format": "uri"
  30534. },
  30535. "chat": {
  30536. "type": "string",
  30537. "description": "URL to the support chat.",
  30538. "format": "uri"
  30539. },
  30540. "source": {
  30541. "type": "string",
  30542. "description": "URL to browse or download the sources.",
  30543. "format": "uri"
  30544. },
  30545. "docs": {
  30546. "type": "string",
  30547. "description": "URL to the documentation.",
  30548. "format": "uri"
  30549. },
  30550. "rss": {
  30551. "type": "string",
  30552. "description": "URL to the RSS feed.",
  30553. "format": "uri"
  30554. }
  30555. }
  30556. },
  30557. "funding": {
  30558. "type": "array",
  30559. "description": "A list of options to fund the development and maintenance of the package.",
  30560. "items": {
  30561. "type": "object",
  30562. "properties": {
  30563. "type": {
  30564. "type": "string",
  30565. "description": "Type of funding or platform through which funding is possible."
  30566. },
  30567. "url": {
  30568. "type": "string",
  30569. "description": "URL to a website with details on funding and a way to fund the package.",
  30570. "format": "uri"
  30571. }
  30572. }
  30573. }
  30574. },
  30575. "non-feature-branches": {
  30576. "type": ["array"],
  30577. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  30578. "items": {
  30579. "type": "string"
  30580. }
  30581. },
  30582. "abandoned": {
  30583. "type": ["boolean", "string"],
  30584. "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."
  30585. },
  30586. "_comment": {
  30587. "type": ["array", "string"],
  30588. "description": "A key to store comments in"
  30589. }
  30590. },
  30591. "definitions": {
  30592. "authors": {
  30593. "type": "array",
  30594. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  30595. "items": {
  30596. "type": "object",
  30597. "additionalProperties": false,
  30598. "required": [ "name"],
  30599. "properties": {
  30600. "name": {
  30601. "type": "string",
  30602. "description": "Full name of the author."
  30603. },
  30604. "email": {
  30605. "type": "string",
  30606. "description": "Email address of the author.",
  30607. "format": "email"
  30608. },
  30609. "homepage": {
  30610. "type": "string",
  30611. "description": "Homepage URL for the author.",
  30612. "format": "uri"
  30613. },
  30614. "role": {
  30615. "type": "string",
  30616. "description": "Author's role in the project."
  30617. }
  30618. }
  30619. }
  30620. },
  30621. "autoload": {
  30622. "type": "object",
  30623. "description": "Description of how the package can be autoloaded.",
  30624. "properties": {
  30625. "psr-0": {
  30626. "type": "object",
  30627. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  30628. "additionalProperties": {
  30629. "type": ["string", "array"],
  30630. "items": {
  30631. "type": "string"
  30632. }
  30633. }
  30634. },
  30635. "psr-4": {
  30636. "type": "object",
  30637. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30638. "additionalProperties": {
  30639. "type": ["string", "array"],
  30640. "items": {
  30641. "type": "string"
  30642. }
  30643. }
  30644. },
  30645. "classmap": {
  30646. "type": "array",
  30647. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30648. },
  30649. "files": {
  30650. "type": "array",
  30651. "description": "This is an array of files that are always required on every request."
  30652. },
  30653. "exclude-from-classmap": {
  30654. "type": "array",
  30655. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  30656. }
  30657. }
  30658. },
  30659. "repository": {
  30660. "type": "object",
  30661. "oneOf": [
  30662. { "$ref": "#/definitions/composer-repository" },
  30663. { "$ref": "#/definitions/vcs-repository" },
  30664. { "$ref": "#/definitions/path-repository" },
  30665. { "$ref": "#/definitions/artifact-repository" },
  30666. { "$ref": "#/definitions/pear-repository" },
  30667. { "$ref": "#/definitions/package-repository" }
  30668. ]
  30669. },
  30670. "composer-repository": {
  30671. "type": "object",
  30672. "required": ["type", "url"],
  30673. "properties": {
  30674. "type": { "type": "string", "enum": ["composer"] },
  30675. "url": { "type": "string" },
  30676. "options": {
  30677. "type": "object",
  30678. "additionalProperties": true
  30679. },
  30680. "allow_ssl_downgrade": { "type": "boolean" },
  30681. "force-lazy-providers": { "type": "boolean" }
  30682. }
  30683. },
  30684. "vcs-repository": {
  30685. "type": "object",
  30686. "required": ["type", "url"],
  30687. "properties": {
  30688. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  30689. "url": { "type": "string" },
  30690. "no-api": { "type": "boolean" },
  30691. "secure-http": { "type": "boolean" },
  30692. "svn-cache-credentials": { "type": "boolean" },
  30693. "trunk-path": { "type": ["string", "boolean"] },
  30694. "branches-path": { "type": ["string", "boolean"] },
  30695. "tags-path": { "type": ["string", "boolean"] },
  30696. "package-path": { "type": "string" },
  30697. "depot": { "type": "string" },
  30698. "branch": { "type": "string" },
  30699. "unique_perforce_client_name": { "type": "string" },
  30700. "p4user": { "type": "string" },
  30701. "p4password": { "type": "string" }
  30702. }
  30703. },
  30704. "path-repository": {
  30705. "type": "object",
  30706. "required": ["type", "url"],
  30707. "properties": {
  30708. "type": { "type": "string", "enum": ["path"] },
  30709. "url": { "type": "string" },
  30710. "options": {
  30711. "type": "object",
  30712. "properties": {
  30713. "symlink": { "type": ["boolean", "null"] }
  30714. },
  30715. "additionalProperties": true
  30716. }
  30717. }
  30718. },
  30719. "artifact-repository": {
  30720. "type": "object",
  30721. "required": ["type", "url"],
  30722. "properties": {
  30723. "type": { "type": "string", "enum": ["artifact"] },
  30724. "url": { "type": "string" }
  30725. }
  30726. },
  30727. "pear-repository": {
  30728. "type": "object",
  30729. "required": ["type", "url"],
  30730. "properties": {
  30731. "type": { "type": "string", "enum": ["pear"] },
  30732. "url": { "type": "string" },
  30733. "vendor-alias": { "type": "string" }
  30734. }
  30735. },
  30736. "package-repository": {
  30737. "type": "object",
  30738. "required": ["type", "package"],
  30739. "properties": {
  30740. "type": { "type": "string", "enum": ["package"] },
  30741. "package": {
  30742. "oneOf": [
  30743. { "$ref": "#/definitions/inline-package" },
  30744. {
  30745. "type": "array",
  30746. "items": { "$ref": "#/definitions/inline-package" }
  30747. }
  30748. ]
  30749. }
  30750. }
  30751. },
  30752. "inline-package": {
  30753. "type": "object",
  30754. "required": ["name", "version"],
  30755. "properties": {
  30756. "name": {
  30757. "type": "string",
  30758. "description": "Package name, including 'vendor-name/' prefix."
  30759. },
  30760. "type": {
  30761. "type": "string"
  30762. },
  30763. "target-dir": {
  30764. "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.",
  30765. "type": "string"
  30766. },
  30767. "description": {
  30768. "type": "string"
  30769. },
  30770. "keywords": {
  30771. "type": "array",
  30772. "items": {
  30773. "type": "string"
  30774. }
  30775. },
  30776. "homepage": {
  30777. "type": "string",
  30778. "format": "uri"
  30779. },
  30780. "version": {
  30781. "type": "string"
  30782. },
  30783. "time": {
  30784. "type": "string"
  30785. },
  30786. "license": {
  30787. "type": [
  30788. "string",
  30789. "array"
  30790. ]
  30791. },
  30792. "authors": {
  30793. "$ref": "#/definitions/authors"
  30794. },
  30795. "require": {
  30796. "type": "object",
  30797. "additionalProperties": {
  30798. "type": "string"
  30799. }
  30800. },
  30801. "replace": {
  30802. "type": "object",
  30803. "additionalProperties": {
  30804. "type": "string"
  30805. }
  30806. },
  30807. "conflict": {
  30808. "type": "object",
  30809. "additionalProperties": {
  30810. "type": "string"
  30811. }
  30812. },
  30813. "provide": {
  30814. "type": "object",
  30815. "additionalProperties": {
  30816. "type": "string"
  30817. }
  30818. },
  30819. "require-dev": {
  30820. "type": "object",
  30821. "additionalProperties": {
  30822. "type": "string"
  30823. }
  30824. },
  30825. "suggest": {
  30826. "type": "object",
  30827. "additionalProperties": {
  30828. "type": "string"
  30829. }
  30830. },
  30831. "extra": {
  30832. "type": ["object", "array"],
  30833. "additionalProperties": true
  30834. },
  30835. "autoload": {
  30836. "$ref": "#/definitions/autoload"
  30837. },
  30838. "archive": {
  30839. "type": ["object"],
  30840. "properties": {
  30841. "exclude": {
  30842. "type": "array"
  30843. }
  30844. }
  30845. },
  30846. "bin": {
  30847. "type": ["string", "array"],
  30848. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30849. "items": {
  30850. "type": "string"
  30851. }
  30852. },
  30853. "include-path": {
  30854. "type": ["array"],
  30855. "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.",
  30856. "items": {
  30857. "type": "string"
  30858. }
  30859. },
  30860. "source": {
  30861. "type": "object",
  30862. "required": ["type", "url", "reference"],
  30863. "properties": {
  30864. "type": {
  30865. "type": "string"
  30866. },
  30867. "url": {
  30868. "type": "string"
  30869. },
  30870. "reference": {
  30871. "type": "string"
  30872. },
  30873. "mirrors": {
  30874. "type": "array"
  30875. }
  30876. }
  30877. },
  30878. "dist": {
  30879. "type": "object",
  30880. "required": ["type", "url"],
  30881. "properties": {
  30882. "type": {
  30883. "type": "string"
  30884. },
  30885. "url": {
  30886. "type": "string"
  30887. },
  30888. "reference": {
  30889. "type": "string"
  30890. },
  30891. "shasum": {
  30892. "type": "string"
  30893. },
  30894. "mirrors": {
  30895. "type": "array"
  30896. }
  30897. }
  30898. }
  30899. },
  30900. "additionalProperties": true
  30901. }
  30902. }
  30903. }
  30904. {
  30905. "389-exception": [
  30906. "389 Directory Server Exception"
  30907. ],
  30908. "Autoconf-exception-2.0": [
  30909. "Autoconf exception 2.0"
  30910. ],
  30911. "Autoconf-exception-3.0": [
  30912. "Autoconf exception 3.0"
  30913. ],
  30914. "Bison-exception-2.2": [
  30915. "Bison exception 2.2"
  30916. ],
  30917. "Bootloader-exception": [
  30918. "Bootloader Distribution Exception"
  30919. ],
  30920. "Classpath-exception-2.0": [
  30921. "Classpath exception 2.0"
  30922. ],
  30923. "CLISP-exception-2.0": [
  30924. "CLISP exception 2.0"
  30925. ],
  30926. "DigiRule-FOSS-exception": [
  30927. "DigiRule FOSS License Exception"
  30928. ],
  30929. "eCos-exception-2.0": [
  30930. "eCos exception 2.0"
  30931. ],
  30932. "Fawkes-Runtime-exception": [
  30933. "Fawkes Runtime Exception"
  30934. ],
  30935. "FLTK-exception": [
  30936. "FLTK exception"
  30937. ],
  30938. "Font-exception-2.0": [
  30939. "Font exception 2.0"
  30940. ],
  30941. "freertos-exception-2.0": [
  30942. "FreeRTOS Exception 2.0"
  30943. ],
  30944. "GCC-exception-2.0": [
  30945. "GCC Runtime Library exception 2.0"
  30946. ],
  30947. "GCC-exception-3.1": [
  30948. "GCC Runtime Library exception 3.1"
  30949. ],
  30950. "gnu-javamail-exception": [
  30951. "GNU JavaMail exception"
  30952. ],
  30953. "GPL-3.0-linking-exception": [
  30954. "GPL-3.0 Linking Exception"
  30955. ],
  30956. "GPL-3.0-linking-source-exception": [
  30957. "GPL-3.0 Linking Exception (with Corresponding Source)"
  30958. ],
  30959. "GPL-CC-1.0": [
  30960. "GPL Cooperation Commitment 1.0"
  30961. ],
  30962. "i2p-gpl-java-exception": [
  30963. "i2p GPL+Java Exception"
  30964. ],
  30965. "LGPL-3.0-linking-exception": [
  30966. "LGPL-3.0 Linking Exception"
  30967. ],
  30968. "Libtool-exception": [
  30969. "Libtool Exception"
  30970. ],
  30971. "Linux-syscall-note": [
  30972. "Linux Syscall Note"
  30973. ],
  30974. "LLVM-exception": [
  30975. "LLVM Exception"
  30976. ],
  30977. "LZMA-exception": [
  30978. "LZMA exception"
  30979. ],
  30980. "mif-exception": [
  30981. "Macros and Inline Functions Exception"
  30982. ],
  30983. "Nokia-Qt-exception-1.1": [
  30984. "Nokia Qt LGPL exception 1.1"
  30985. ],
  30986. "OCaml-LGPL-linking-exception": [
  30987. "OCaml LGPL Linking Exception"
  30988. ],
  30989. "OCCT-exception-1.0": [
  30990. "Open CASCADE Exception 1.0"
  30991. ],
  30992. "OpenJDK-assembly-exception-1.0": [
  30993. "OpenJDK Assembly exception 1.0"
  30994. ],
  30995. "openvpn-openssl-exception": [
  30996. "OpenVPN OpenSSL Exception"
  30997. ],
  30998. "PS-or-PDF-font-exception-20170817": [
  30999. "PS/PDF font exception (2017-08-17)"
  31000. ],
  31001. "Qt-GPL-exception-1.0": [
  31002. "Qt GPL exception 1.0"
  31003. ],
  31004. "Qt-LGPL-exception-1.1": [
  31005. "Qt LGPL exception 1.1"
  31006. ],
  31007. "Qwt-exception-1.0": [
  31008. "Qwt exception 1.0"
  31009. ],
  31010. "SHL-2.0": [
  31011. "Solderpad Hardware License v2.0"
  31012. ],
  31013. "SHL-2.1": [
  31014. "Solderpad Hardware License v2.1"
  31015. ],
  31016. "Swift-exception": [
  31017. "Swift Exception"
  31018. ],
  31019. "u-boot-exception-2.0": [
  31020. "U-Boot exception 2.0"
  31021. ],
  31022. "Universal-FOSS-exception-1.0": [
  31023. "Universal FOSS Exception, Version 1.0"
  31024. ],
  31025. "WxWindows-exception-3.1": [
  31026. "WxWindows Library Exception 3.1"
  31027. ]
  31028. }{
  31029. "0BSD": [
  31030. "BSD Zero Clause License",
  31031. true,
  31032. false
  31033. ],
  31034. "AAL": [
  31035. "Attribution Assurance License",
  31036. true,
  31037. false
  31038. ],
  31039. "Abstyles": [
  31040. "Abstyles License",
  31041. false,
  31042. false
  31043. ],
  31044. "Adobe-2006": [
  31045. "Adobe Systems Incorporated Source Code License Agreement",
  31046. false,
  31047. false
  31048. ],
  31049. "Adobe-Glyph": [
  31050. "Adobe Glyph List License",
  31051. false,
  31052. false
  31053. ],
  31054. "ADSL": [
  31055. "Amazon Digital Services License",
  31056. false,
  31057. false
  31058. ],
  31059. "AFL-1.1": [
  31060. "Academic Free License v1.1",
  31061. true,
  31062. false
  31063. ],
  31064. "AFL-1.2": [
  31065. "Academic Free License v1.2",
  31066. true,
  31067. false
  31068. ],
  31069. "AFL-2.0": [
  31070. "Academic Free License v2.0",
  31071. true,
  31072. false
  31073. ],
  31074. "AFL-2.1": [
  31075. "Academic Free License v2.1",
  31076. true,
  31077. false
  31078. ],
  31079. "AFL-3.0": [
  31080. "Academic Free License v3.0",
  31081. true,
  31082. false
  31083. ],
  31084. "Afmparse": [
  31085. "Afmparse License",
  31086. false,
  31087. false
  31088. ],
  31089. "AGPL-1.0": [
  31090. "Affero General Public License v1.0",
  31091. false,
  31092. true
  31093. ],
  31094. "AGPL-1.0-only": [
  31095. "Affero General Public License v1.0 only",
  31096. false,
  31097. false
  31098. ],
  31099. "AGPL-1.0-or-later": [
  31100. "Affero General Public License v1.0 or later",
  31101. false,
  31102. false
  31103. ],
  31104. "AGPL-3.0": [
  31105. "GNU Affero General Public License v3.0",
  31106. true,
  31107. true
  31108. ],
  31109. "AGPL-3.0-only": [
  31110. "GNU Affero General Public License v3.0 only",
  31111. true,
  31112. false
  31113. ],
  31114. "AGPL-3.0-or-later": [
  31115. "GNU Affero General Public License v3.0 or later",
  31116. true,
  31117. false
  31118. ],
  31119. "Aladdin": [
  31120. "Aladdin Free Public License",
  31121. false,
  31122. false
  31123. ],
  31124. "AMDPLPA": [
  31125. "AMD's plpa_map.c License",
  31126. false,
  31127. false
  31128. ],
  31129. "AML": [
  31130. "Apple MIT License",
  31131. false,
  31132. false
  31133. ],
  31134. "AMPAS": [
  31135. "Academy of Motion Picture Arts and Sciences BSD",
  31136. false,
  31137. false
  31138. ],
  31139. "ANTLR-PD": [
  31140. "ANTLR Software Rights Notice",
  31141. false,
  31142. false
  31143. ],
  31144. "Apache-1.0": [
  31145. "Apache License 1.0",
  31146. false,
  31147. false
  31148. ],
  31149. "Apache-1.1": [
  31150. "Apache License 1.1",
  31151. true,
  31152. false
  31153. ],
  31154. "Apache-2.0": [
  31155. "Apache License 2.0",
  31156. true,
  31157. false
  31158. ],
  31159. "APAFML": [
  31160. "Adobe Postscript AFM License",
  31161. false,
  31162. false
  31163. ],
  31164. "APL-1.0": [
  31165. "Adaptive Public License 1.0",
  31166. true,
  31167. false
  31168. ],
  31169. "APSL-1.0": [
  31170. "Apple Public Source License 1.0",
  31171. true,
  31172. false
  31173. ],
  31174. "APSL-1.1": [
  31175. "Apple Public Source License 1.1",
  31176. true,
  31177. false
  31178. ],
  31179. "APSL-1.2": [
  31180. "Apple Public Source License 1.2",
  31181. true,
  31182. false
  31183. ],
  31184. "APSL-2.0": [
  31185. "Apple Public Source License 2.0",
  31186. true,
  31187. false
  31188. ],
  31189. "Artistic-1.0": [
  31190. "Artistic License 1.0",
  31191. true,
  31192. false
  31193. ],
  31194. "Artistic-1.0-cl8": [
  31195. "Artistic License 1.0 w/clause 8",
  31196. true,
  31197. false
  31198. ],
  31199. "Artistic-1.0-Perl": [
  31200. "Artistic License 1.0 (Perl)",
  31201. true,
  31202. false
  31203. ],
  31204. "Artistic-2.0": [
  31205. "Artistic License 2.0",
  31206. true,
  31207. false
  31208. ],
  31209. "Bahyph": [
  31210. "Bahyph License",
  31211. false,
  31212. false
  31213. ],
  31214. "Barr": [
  31215. "Barr License",
  31216. false,
  31217. false
  31218. ],
  31219. "Beerware": [
  31220. "Beerware License",
  31221. false,
  31222. false
  31223. ],
  31224. "BitTorrent-1.0": [
  31225. "BitTorrent Open Source License v1.0",
  31226. false,
  31227. false
  31228. ],
  31229. "BitTorrent-1.1": [
  31230. "BitTorrent Open Source License v1.1",
  31231. false,
  31232. false
  31233. ],
  31234. "blessing": [
  31235. "SQLite Blessing",
  31236. false,
  31237. false
  31238. ],
  31239. "BlueOak-1.0.0": [
  31240. "Blue Oak Model License 1.0.0",
  31241. false,
  31242. false
  31243. ],
  31244. "Borceux": [
  31245. "Borceux license",
  31246. false,
  31247. false
  31248. ],
  31249. "BSD-1-Clause": [
  31250. "BSD 1-Clause License",
  31251. true,
  31252. false
  31253. ],
  31254. "BSD-2-Clause": [
  31255. "BSD 2-Clause \"Simplified\" License",
  31256. true,
  31257. false
  31258. ],
  31259. "BSD-2-Clause-FreeBSD": [
  31260. "BSD 2-Clause FreeBSD License",
  31261. false,
  31262. false
  31263. ],
  31264. "BSD-2-Clause-NetBSD": [
  31265. "BSD 2-Clause NetBSD License",
  31266. false,
  31267. true
  31268. ],
  31269. "BSD-2-Clause-Patent": [
  31270. "BSD-2-Clause Plus Patent License",
  31271. true,
  31272. false
  31273. ],
  31274. "BSD-3-Clause": [
  31275. "BSD 3-Clause \"New\" or \"Revised\" License",
  31276. true,
  31277. false
  31278. ],
  31279. "BSD-3-Clause-Attribution": [
  31280. "BSD with attribution",
  31281. false,
  31282. false
  31283. ],
  31284. "BSD-3-Clause-Clear": [
  31285. "BSD 3-Clause Clear License",
  31286. false,
  31287. false
  31288. ],
  31289. "BSD-3-Clause-LBNL": [
  31290. "Lawrence Berkeley National Labs BSD variant license",
  31291. true,
  31292. false
  31293. ],
  31294. "BSD-3-Clause-No-Nuclear-License": [
  31295. "BSD 3-Clause No Nuclear License",
  31296. false,
  31297. false
  31298. ],
  31299. "BSD-3-Clause-No-Nuclear-License-2014": [
  31300. "BSD 3-Clause No Nuclear License 2014",
  31301. false,
  31302. false
  31303. ],
  31304. "BSD-3-Clause-No-Nuclear-Warranty": [
  31305. "BSD 3-Clause No Nuclear Warranty",
  31306. false,
  31307. false
  31308. ],
  31309. "BSD-3-Clause-Open-MPI": [
  31310. "BSD 3-Clause Open MPI variant",
  31311. false,
  31312. false
  31313. ],
  31314. "BSD-4-Clause": [
  31315. "BSD 4-Clause \"Original\" or \"Old\" License",
  31316. false,
  31317. false
  31318. ],
  31319. "BSD-4-Clause-UC": [
  31320. "BSD-4-Clause (University of California-Specific)",
  31321. false,
  31322. false
  31323. ],
  31324. "BSD-Protection": [
  31325. "BSD Protection License",
  31326. false,
  31327. false
  31328. ],
  31329. "BSD-Source-Code": [
  31330. "BSD Source Code Attribution",
  31331. false,
  31332. false
  31333. ],
  31334. "BSL-1.0": [
  31335. "Boost Software License 1.0",
  31336. true,
  31337. false
  31338. ],
  31339. "bzip2-1.0.5": [
  31340. "bzip2 and libbzip2 License v1.0.5",
  31341. false,
  31342. false
  31343. ],
  31344. "bzip2-1.0.6": [
  31345. "bzip2 and libbzip2 License v1.0.6",
  31346. false,
  31347. false
  31348. ],
  31349. "CAL-1.0": [
  31350. "Cryptographic Autonomy License 1.0",
  31351. true,
  31352. false
  31353. ],
  31354. "CAL-1.0-Combined-Work-Exception": [
  31355. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  31356. true,
  31357. false
  31358. ],
  31359. "Caldera": [
  31360. "Caldera License",
  31361. false,
  31362. false
  31363. ],
  31364. "CATOSL-1.1": [
  31365. "Computer Associates Trusted Open Source License 1.1",
  31366. true,
  31367. false
  31368. ],
  31369. "CC-BY-1.0": [
  31370. "Creative Commons Attribution 1.0 Generic",
  31371. false,
  31372. false
  31373. ],
  31374. "CC-BY-2.0": [
  31375. "Creative Commons Attribution 2.0 Generic",
  31376. false,
  31377. false
  31378. ],
  31379. "CC-BY-2.5": [
  31380. "Creative Commons Attribution 2.5 Generic",
  31381. false,
  31382. false
  31383. ],
  31384. "CC-BY-3.0": [
  31385. "Creative Commons Attribution 3.0 Unported",
  31386. false,
  31387. false
  31388. ],
  31389. "CC-BY-4.0": [
  31390. "Creative Commons Attribution 4.0 International",
  31391. false,
  31392. false
  31393. ],
  31394. "CC-BY-NC-1.0": [
  31395. "Creative Commons Attribution Non Commercial 1.0 Generic",
  31396. false,
  31397. false
  31398. ],
  31399. "CC-BY-NC-2.0": [
  31400. "Creative Commons Attribution Non Commercial 2.0 Generic",
  31401. false,
  31402. false
  31403. ],
  31404. "CC-BY-NC-2.5": [
  31405. "Creative Commons Attribution Non Commercial 2.5 Generic",
  31406. false,
  31407. false
  31408. ],
  31409. "CC-BY-NC-3.0": [
  31410. "Creative Commons Attribution Non Commercial 3.0 Unported",
  31411. false,
  31412. false
  31413. ],
  31414. "CC-BY-NC-4.0": [
  31415. "Creative Commons Attribution Non Commercial 4.0 International",
  31416. false,
  31417. false
  31418. ],
  31419. "CC-BY-NC-ND-1.0": [
  31420. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  31421. false,
  31422. false
  31423. ],
  31424. "CC-BY-NC-ND-2.0": [
  31425. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  31426. false,
  31427. false
  31428. ],
  31429. "CC-BY-NC-ND-2.5": [
  31430. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  31431. false,
  31432. false
  31433. ],
  31434. "CC-BY-NC-ND-3.0": [
  31435. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  31436. false,
  31437. false
  31438. ],
  31439. "CC-BY-NC-ND-4.0": [
  31440. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  31441. false,
  31442. false
  31443. ],
  31444. "CC-BY-NC-SA-1.0": [
  31445. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  31446. false,
  31447. false
  31448. ],
  31449. "CC-BY-NC-SA-2.0": [
  31450. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  31451. false,
  31452. false
  31453. ],
  31454. "CC-BY-NC-SA-2.5": [
  31455. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  31456. false,
  31457. false
  31458. ],
  31459. "CC-BY-NC-SA-3.0": [
  31460. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  31461. false,
  31462. false
  31463. ],
  31464. "CC-BY-NC-SA-4.0": [
  31465. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  31466. false,
  31467. false
  31468. ],
  31469. "CC-BY-ND-1.0": [
  31470. "Creative Commons Attribution No Derivatives 1.0 Generic",
  31471. false,
  31472. false
  31473. ],
  31474. "CC-BY-ND-2.0": [
  31475. "Creative Commons Attribution No Derivatives 2.0 Generic",
  31476. false,
  31477. false
  31478. ],
  31479. "CC-BY-ND-2.5": [
  31480. "Creative Commons Attribution No Derivatives 2.5 Generic",
  31481. false,
  31482. false
  31483. ],
  31484. "CC-BY-ND-3.0": [
  31485. "Creative Commons Attribution No Derivatives 3.0 Unported",
  31486. false,
  31487. false
  31488. ],
  31489. "CC-BY-ND-4.0": [
  31490. "Creative Commons Attribution No Derivatives 4.0 International",
  31491. false,
  31492. false
  31493. ],
  31494. "CC-BY-SA-1.0": [
  31495. "Creative Commons Attribution Share Alike 1.0 Generic",
  31496. false,
  31497. false
  31498. ],
  31499. "CC-BY-SA-2.0": [
  31500. "Creative Commons Attribution Share Alike 2.0 Generic",
  31501. false,
  31502. false
  31503. ],
  31504. "CC-BY-SA-2.5": [
  31505. "Creative Commons Attribution Share Alike 2.5 Generic",
  31506. false,
  31507. false
  31508. ],
  31509. "CC-BY-SA-3.0": [
  31510. "Creative Commons Attribution Share Alike 3.0 Unported",
  31511. false,
  31512. false
  31513. ],
  31514. "CC-BY-SA-4.0": [
  31515. "Creative Commons Attribution Share Alike 4.0 International",
  31516. false,
  31517. false
  31518. ],
  31519. "CC-PDDC": [
  31520. "Creative Commons Public Domain Dedication and Certification",
  31521. false,
  31522. false
  31523. ],
  31524. "CC0-1.0": [
  31525. "Creative Commons Zero v1.0 Universal",
  31526. false,
  31527. false
  31528. ],
  31529. "CDDL-1.0": [
  31530. "Common Development and Distribution License 1.0",
  31531. true,
  31532. false
  31533. ],
  31534. "CDDL-1.1": [
  31535. "Common Development and Distribution License 1.1",
  31536. false,
  31537. false
  31538. ],
  31539. "CDLA-Permissive-1.0": [
  31540. "Community Data License Agreement Permissive 1.0",
  31541. false,
  31542. false
  31543. ],
  31544. "CDLA-Sharing-1.0": [
  31545. "Community Data License Agreement Sharing 1.0",
  31546. false,
  31547. false
  31548. ],
  31549. "CECILL-1.0": [
  31550. "CeCILL Free Software License Agreement v1.0",
  31551. false,
  31552. false
  31553. ],
  31554. "CECILL-1.1": [
  31555. "CeCILL Free Software License Agreement v1.1",
  31556. false,
  31557. false
  31558. ],
  31559. "CECILL-2.0": [
  31560. "CeCILL Free Software License Agreement v2.0",
  31561. false,
  31562. false
  31563. ],
  31564. "CECILL-2.1": [
  31565. "CeCILL Free Software License Agreement v2.1",
  31566. true,
  31567. false
  31568. ],
  31569. "CECILL-B": [
  31570. "CeCILL-B Free Software License Agreement",
  31571. false,
  31572. false
  31573. ],
  31574. "CECILL-C": [
  31575. "CeCILL-C Free Software License Agreement",
  31576. false,
  31577. false
  31578. ],
  31579. "CERN-OHL-1.1": [
  31580. "CERN Open Hardware Licence v1.1",
  31581. false,
  31582. false
  31583. ],
  31584. "CERN-OHL-1.2": [
  31585. "CERN Open Hardware Licence v1.2",
  31586. false,
  31587. false
  31588. ],
  31589. "CERN-OHL-P-2.0": [
  31590. "CERN Open Hardware Licence Version 2 - Permissive",
  31591. false,
  31592. false
  31593. ],
  31594. "CERN-OHL-S-2.0": [
  31595. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  31596. false,
  31597. false
  31598. ],
  31599. "CERN-OHL-W-2.0": [
  31600. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  31601. false,
  31602. false
  31603. ],
  31604. "ClArtistic": [
  31605. "Clarified Artistic License",
  31606. false,
  31607. false
  31608. ],
  31609. "CNRI-Jython": [
  31610. "CNRI Jython License",
  31611. false,
  31612. false
  31613. ],
  31614. "CNRI-Python": [
  31615. "CNRI Python License",
  31616. true,
  31617. false
  31618. ],
  31619. "CNRI-Python-GPL-Compatible": [
  31620. "CNRI Python Open Source GPL Compatible License Agreement",
  31621. false,
  31622. false
  31623. ],
  31624. "Condor-1.1": [
  31625. "Condor Public License v1.1",
  31626. false,
  31627. false
  31628. ],
  31629. "copyleft-next-0.3.0": [
  31630. "copyleft-next 0.3.0",
  31631. false,
  31632. false
  31633. ],
  31634. "copyleft-next-0.3.1": [
  31635. "copyleft-next 0.3.1",
  31636. false,
  31637. false
  31638. ],
  31639. "CPAL-1.0": [
  31640. "Common Public Attribution License 1.0",
  31641. true,
  31642. false
  31643. ],
  31644. "CPL-1.0": [
  31645. "Common Public License 1.0",
  31646. true,
  31647. false
  31648. ],
  31649. "CPOL-1.02": [
  31650. "Code Project Open License 1.02",
  31651. false,
  31652. false
  31653. ],
  31654. "Crossword": [
  31655. "Crossword License",
  31656. false,
  31657. false
  31658. ],
  31659. "CrystalStacker": [
  31660. "CrystalStacker License",
  31661. false,
  31662. false
  31663. ],
  31664. "CUA-OPL-1.0": [
  31665. "CUA Office Public License v1.0",
  31666. true,
  31667. false
  31668. ],
  31669. "Cube": [
  31670. "Cube License",
  31671. false,
  31672. false
  31673. ],
  31674. "curl": [
  31675. "curl License",
  31676. false,
  31677. false
  31678. ],
  31679. "D-FSL-1.0": [
  31680. "Deutsche Freie Software Lizenz",
  31681. false,
  31682. false
  31683. ],
  31684. "diffmark": [
  31685. "diffmark license",
  31686. false,
  31687. false
  31688. ],
  31689. "DOC": [
  31690. "DOC License",
  31691. false,
  31692. false
  31693. ],
  31694. "Dotseqn": [
  31695. "Dotseqn License",
  31696. false,
  31697. false
  31698. ],
  31699. "DSDP": [
  31700. "DSDP License",
  31701. false,
  31702. false
  31703. ],
  31704. "dvipdfm": [
  31705. "dvipdfm License",
  31706. false,
  31707. false
  31708. ],
  31709. "ECL-1.0": [
  31710. "Educational Community License v1.0",
  31711. true,
  31712. false
  31713. ],
  31714. "ECL-2.0": [
  31715. "Educational Community License v2.0",
  31716. true,
  31717. false
  31718. ],
  31719. "eCos-2.0": [
  31720. "eCos license version 2.0",
  31721. false,
  31722. true
  31723. ],
  31724. "EFL-1.0": [
  31725. "Eiffel Forum License v1.0",
  31726. true,
  31727. false
  31728. ],
  31729. "EFL-2.0": [
  31730. "Eiffel Forum License v2.0",
  31731. true,
  31732. false
  31733. ],
  31734. "eGenix": [
  31735. "eGenix.com Public License 1.1.0",
  31736. false,
  31737. false
  31738. ],
  31739. "Entessa": [
  31740. "Entessa Public License v1.0",
  31741. true,
  31742. false
  31743. ],
  31744. "EPL-1.0": [
  31745. "Eclipse Public License 1.0",
  31746. true,
  31747. false
  31748. ],
  31749. "EPL-2.0": [
  31750. "Eclipse Public License 2.0",
  31751. true,
  31752. false
  31753. ],
  31754. "ErlPL-1.1": [
  31755. "Erlang Public License v1.1",
  31756. false,
  31757. false
  31758. ],
  31759. "etalab-2.0": [
  31760. "Etalab Open License 2.0",
  31761. false,
  31762. false
  31763. ],
  31764. "EUDatagrid": [
  31765. "EU DataGrid Software License",
  31766. true,
  31767. false
  31768. ],
  31769. "EUPL-1.0": [
  31770. "European Union Public License 1.0",
  31771. false,
  31772. false
  31773. ],
  31774. "EUPL-1.1": [
  31775. "European Union Public License 1.1",
  31776. true,
  31777. false
  31778. ],
  31779. "EUPL-1.2": [
  31780. "European Union Public License 1.2",
  31781. true,
  31782. false
  31783. ],
  31784. "Eurosym": [
  31785. "Eurosym License",
  31786. false,
  31787. false
  31788. ],
  31789. "Fair": [
  31790. "Fair License",
  31791. true,
  31792. false
  31793. ],
  31794. "Frameworx-1.0": [
  31795. "Frameworx Open License 1.0",
  31796. true,
  31797. false
  31798. ],
  31799. "FreeImage": [
  31800. "FreeImage Public License v1.0",
  31801. false,
  31802. false
  31803. ],
  31804. "FSFAP": [
  31805. "FSF All Permissive License",
  31806. false,
  31807. false
  31808. ],
  31809. "FSFUL": [
  31810. "FSF Unlimited License",
  31811. false,
  31812. false
  31813. ],
  31814. "FSFULLR": [
  31815. "FSF Unlimited License (with License Retention)",
  31816. false,
  31817. false
  31818. ],
  31819. "FTL": [
  31820. "Freetype Project License",
  31821. false,
  31822. false
  31823. ],
  31824. "GFDL-1.1": [
  31825. "GNU Free Documentation License v1.1",
  31826. false,
  31827. true
  31828. ],
  31829. "GFDL-1.1-only": [
  31830. "GNU Free Documentation License v1.1 only",
  31831. false,
  31832. false
  31833. ],
  31834. "GFDL-1.1-or-later": [
  31835. "GNU Free Documentation License v1.1 or later",
  31836. false,
  31837. false
  31838. ],
  31839. "GFDL-1.2": [
  31840. "GNU Free Documentation License v1.2",
  31841. false,
  31842. true
  31843. ],
  31844. "GFDL-1.2-only": [
  31845. "GNU Free Documentation License v1.2 only",
  31846. false,
  31847. false
  31848. ],
  31849. "GFDL-1.2-or-later": [
  31850. "GNU Free Documentation License v1.2 or later",
  31851. false,
  31852. false
  31853. ],
  31854. "GFDL-1.3": [
  31855. "GNU Free Documentation License v1.3",
  31856. false,
  31857. true
  31858. ],
  31859. "GFDL-1.3-only": [
  31860. "GNU Free Documentation License v1.3 only",
  31861. false,
  31862. false
  31863. ],
  31864. "GFDL-1.3-or-later": [
  31865. "GNU Free Documentation License v1.3 or later",
  31866. false,
  31867. false
  31868. ],
  31869. "Giftware": [
  31870. "Giftware License",
  31871. false,
  31872. false
  31873. ],
  31874. "GL2PS": [
  31875. "GL2PS License",
  31876. false,
  31877. false
  31878. ],
  31879. "Glide": [
  31880. "3dfx Glide License",
  31881. false,
  31882. false
  31883. ],
  31884. "Glulxe": [
  31885. "Glulxe License",
  31886. false,
  31887. false
  31888. ],
  31889. "gnuplot": [
  31890. "gnuplot License",
  31891. false,
  31892. false
  31893. ],
  31894. "GPL-1.0": [
  31895. "GNU General Public License v1.0 only",
  31896. false,
  31897. true
  31898. ],
  31899. "GPL-1.0+": [
  31900. "GNU General Public License v1.0 or later",
  31901. false,
  31902. true
  31903. ],
  31904. "GPL-1.0-only": [
  31905. "GNU General Public License v1.0 only",
  31906. false,
  31907. false
  31908. ],
  31909. "GPL-1.0-or-later": [
  31910. "GNU General Public License v1.0 or later",
  31911. false,
  31912. false
  31913. ],
  31914. "GPL-2.0": [
  31915. "GNU General Public License v2.0 only",
  31916. true,
  31917. true
  31918. ],
  31919. "GPL-2.0+": [
  31920. "GNU General Public License v2.0 or later",
  31921. true,
  31922. true
  31923. ],
  31924. "GPL-2.0-only": [
  31925. "GNU General Public License v2.0 only",
  31926. true,
  31927. false
  31928. ],
  31929. "GPL-2.0-or-later": [
  31930. "GNU General Public License v2.0 or later",
  31931. true,
  31932. false
  31933. ],
  31934. "GPL-2.0-with-autoconf-exception": [
  31935. "GNU General Public License v2.0 w/Autoconf exception",
  31936. false,
  31937. true
  31938. ],
  31939. "GPL-2.0-with-bison-exception": [
  31940. "GNU General Public License v2.0 w/Bison exception",
  31941. false,
  31942. true
  31943. ],
  31944. "GPL-2.0-with-classpath-exception": [
  31945. "GNU General Public License v2.0 w/Classpath exception",
  31946. false,
  31947. true
  31948. ],
  31949. "GPL-2.0-with-font-exception": [
  31950. "GNU General Public License v2.0 w/Font exception",
  31951. false,
  31952. true
  31953. ],
  31954. "GPL-2.0-with-GCC-exception": [
  31955. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  31956. false,
  31957. true
  31958. ],
  31959. "GPL-3.0": [
  31960. "GNU General Public License v3.0 only",
  31961. true,
  31962. true
  31963. ],
  31964. "GPL-3.0+": [
  31965. "GNU General Public License v3.0 or later",
  31966. true,
  31967. true
  31968. ],
  31969. "GPL-3.0-only": [
  31970. "GNU General Public License v3.0 only",
  31971. true,
  31972. false
  31973. ],
  31974. "GPL-3.0-or-later": [
  31975. "GNU General Public License v3.0 or later",
  31976. true,
  31977. false
  31978. ],
  31979. "GPL-3.0-with-autoconf-exception": [
  31980. "GNU General Public License v3.0 w/Autoconf exception",
  31981. false,
  31982. true
  31983. ],
  31984. "GPL-3.0-with-GCC-exception": [
  31985. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  31986. true,
  31987. true
  31988. ],
  31989. "gSOAP-1.3b": [
  31990. "gSOAP Public License v1.3b",
  31991. false,
  31992. false
  31993. ],
  31994. "HaskellReport": [
  31995. "Haskell Language Report License",
  31996. false,
  31997. false
  31998. ],
  31999. "Hippocratic-2.1": [
  32000. "Hippocratic License 2.1",
  32001. false,
  32002. false
  32003. ],
  32004. "HPND": [
  32005. "Historical Permission Notice and Disclaimer",
  32006. true,
  32007. false
  32008. ],
  32009. "HPND-sell-variant": [
  32010. "Historical Permission Notice and Disclaimer - sell variant",
  32011. false,
  32012. false
  32013. ],
  32014. "IBM-pibs": [
  32015. "IBM PowerPC Initialization and Boot Software",
  32016. false,
  32017. false
  32018. ],
  32019. "ICU": [
  32020. "ICU License",
  32021. false,
  32022. false
  32023. ],
  32024. "IJG": [
  32025. "Independent JPEG Group License",
  32026. false,
  32027. false
  32028. ],
  32029. "ImageMagick": [
  32030. "ImageMagick License",
  32031. false,
  32032. false
  32033. ],
  32034. "iMatix": [
  32035. "iMatix Standard Function Library Agreement",
  32036. false,
  32037. false
  32038. ],
  32039. "Imlib2": [
  32040. "Imlib2 License",
  32041. false,
  32042. false
  32043. ],
  32044. "Info-ZIP": [
  32045. "Info-ZIP License",
  32046. false,
  32047. false
  32048. ],
  32049. "Intel": [
  32050. "Intel Open Source License",
  32051. true,
  32052. false
  32053. ],
  32054. "Intel-ACPI": [
  32055. "Intel ACPI Software License Agreement",
  32056. false,
  32057. false
  32058. ],
  32059. "Interbase-1.0": [
  32060. "Interbase Public License v1.0",
  32061. false,
  32062. false
  32063. ],
  32064. "IPA": [
  32065. "IPA Font License",
  32066. true,
  32067. false
  32068. ],
  32069. "IPL-1.0": [
  32070. "IBM Public License v1.0",
  32071. true,
  32072. false
  32073. ],
  32074. "ISC": [
  32075. "ISC License",
  32076. true,
  32077. false
  32078. ],
  32079. "JasPer-2.0": [
  32080. "JasPer License",
  32081. false,
  32082. false
  32083. ],
  32084. "JPNIC": [
  32085. "Japan Network Information Center License",
  32086. false,
  32087. false
  32088. ],
  32089. "JSON": [
  32090. "JSON License",
  32091. false,
  32092. false
  32093. ],
  32094. "LAL-1.2": [
  32095. "Licence Art Libre 1.2",
  32096. false,
  32097. false
  32098. ],
  32099. "LAL-1.3": [
  32100. "Licence Art Libre 1.3",
  32101. false,
  32102. false
  32103. ],
  32104. "Latex2e": [
  32105. "Latex2e License",
  32106. false,
  32107. false
  32108. ],
  32109. "Leptonica": [
  32110. "Leptonica License",
  32111. false,
  32112. false
  32113. ],
  32114. "LGPL-2.0": [
  32115. "GNU Library General Public License v2 only",
  32116. true,
  32117. true
  32118. ],
  32119. "LGPL-2.0+": [
  32120. "GNU Library General Public License v2 or later",
  32121. true,
  32122. true
  32123. ],
  32124. "LGPL-2.0-only": [
  32125. "GNU Library General Public License v2 only",
  32126. true,
  32127. false
  32128. ],
  32129. "LGPL-2.0-or-later": [
  32130. "GNU Library General Public License v2 or later",
  32131. true,
  32132. false
  32133. ],
  32134. "LGPL-2.1": [
  32135. "GNU Lesser General Public License v2.1 only",
  32136. true,
  32137. true
  32138. ],
  32139. "LGPL-2.1+": [
  32140. "GNU Library General Public License v2.1 or later",
  32141. true,
  32142. true
  32143. ],
  32144. "LGPL-2.1-only": [
  32145. "GNU Lesser General Public License v2.1 only",
  32146. true,
  32147. false
  32148. ],
  32149. "LGPL-2.1-or-later": [
  32150. "GNU Lesser General Public License v2.1 or later",
  32151. true,
  32152. false
  32153. ],
  32154. "LGPL-3.0": [
  32155. "GNU Lesser General Public License v3.0 only",
  32156. true,
  32157. true
  32158. ],
  32159. "LGPL-3.0+": [
  32160. "GNU Lesser General Public License v3.0 or later",
  32161. true,
  32162. true
  32163. ],
  32164. "LGPL-3.0-only": [
  32165. "GNU Lesser General Public License v3.0 only",
  32166. true,
  32167. false
  32168. ],
  32169. "LGPL-3.0-or-later": [
  32170. "GNU Lesser General Public License v3.0 or later",
  32171. true,
  32172. false
  32173. ],
  32174. "LGPLLR": [
  32175. "Lesser General Public License For Linguistic Resources",
  32176. false,
  32177. false
  32178. ],
  32179. "Libpng": [
  32180. "libpng License",
  32181. false,
  32182. false
  32183. ],
  32184. "libpng-2.0": [
  32185. "PNG Reference Library version 2",
  32186. false,
  32187. false
  32188. ],
  32189. "libselinux-1.0": [
  32190. "libselinux public domain notice",
  32191. false,
  32192. false
  32193. ],
  32194. "libtiff": [
  32195. "libtiff License",
  32196. false,
  32197. false
  32198. ],
  32199. "LiLiQ-P-1.1": [
  32200. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  32201. true,
  32202. false
  32203. ],
  32204. "LiLiQ-R-1.1": [
  32205. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  32206. true,
  32207. false
  32208. ],
  32209. "LiLiQ-Rplus-1.1": [
  32210. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  32211. true,
  32212. false
  32213. ],
  32214. "Linux-OpenIB": [
  32215. "Linux Kernel Variant of OpenIB.org license",
  32216. false,
  32217. false
  32218. ],
  32219. "LPL-1.0": [
  32220. "Lucent Public License Version 1.0",
  32221. true,
  32222. false
  32223. ],
  32224. "LPL-1.02": [
  32225. "Lucent Public License v1.02",
  32226. true,
  32227. false
  32228. ],
  32229. "LPPL-1.0": [
  32230. "LaTeX Project Public License v1.0",
  32231. false,
  32232. false
  32233. ],
  32234. "LPPL-1.1": [
  32235. "LaTeX Project Public License v1.1",
  32236. false,
  32237. false
  32238. ],
  32239. "LPPL-1.2": [
  32240. "LaTeX Project Public License v1.2",
  32241. false,
  32242. false
  32243. ],
  32244. "LPPL-1.3a": [
  32245. "LaTeX Project Public License v1.3a",
  32246. false,
  32247. false
  32248. ],
  32249. "LPPL-1.3c": [
  32250. "LaTeX Project Public License v1.3c",
  32251. true,
  32252. false
  32253. ],
  32254. "MakeIndex": [
  32255. "MakeIndex License",
  32256. false,
  32257. false
  32258. ],
  32259. "MirOS": [
  32260. "The MirOS Licence",
  32261. true,
  32262. false
  32263. ],
  32264. "MIT": [
  32265. "MIT License",
  32266. true,
  32267. false
  32268. ],
  32269. "MIT-0": [
  32270. "MIT No Attribution",
  32271. false,
  32272. false
  32273. ],
  32274. "MIT-advertising": [
  32275. "Enlightenment License (e16)",
  32276. false,
  32277. false
  32278. ],
  32279. "MIT-CMU": [
  32280. "CMU License",
  32281. false,
  32282. false
  32283. ],
  32284. "MIT-enna": [
  32285. "enna License",
  32286. false,
  32287. false
  32288. ],
  32289. "MIT-feh": [
  32290. "feh License",
  32291. false,
  32292. false
  32293. ],
  32294. "MITNFA": [
  32295. "MIT +no-false-attribs license",
  32296. false,
  32297. false
  32298. ],
  32299. "Motosoto": [
  32300. "Motosoto License",
  32301. true,
  32302. false
  32303. ],
  32304. "mpich2": [
  32305. "mpich2 License",
  32306. false,
  32307. false
  32308. ],
  32309. "MPL-1.0": [
  32310. "Mozilla Public License 1.0",
  32311. true,
  32312. false
  32313. ],
  32314. "MPL-1.1": [
  32315. "Mozilla Public License 1.1",
  32316. true,
  32317. false
  32318. ],
  32319. "MPL-2.0": [
  32320. "Mozilla Public License 2.0",
  32321. true,
  32322. false
  32323. ],
  32324. "MPL-2.0-no-copyleft-exception": [
  32325. "Mozilla Public License 2.0 (no copyleft exception)",
  32326. true,
  32327. false
  32328. ],
  32329. "MS-PL": [
  32330. "Microsoft Public License",
  32331. true,
  32332. false
  32333. ],
  32334. "MS-RL": [
  32335. "Microsoft Reciprocal License",
  32336. true,
  32337. false
  32338. ],
  32339. "MTLL": [
  32340. "Matrix Template Library License",
  32341. false,
  32342. false
  32343. ],
  32344. "MulanPSL-1.0": [
  32345. "Mulan Permissive Software License, Version 1",
  32346. false,
  32347. false
  32348. ],
  32349. "MulanPSL-2.0": [
  32350. "Mulan Permissive Software License, Version 2",
  32351. true,
  32352. false
  32353. ],
  32354. "Multics": [
  32355. "Multics License",
  32356. true,
  32357. false
  32358. ],
  32359. "Mup": [
  32360. "Mup License",
  32361. false,
  32362. false
  32363. ],
  32364. "NASA-1.3": [
  32365. "NASA Open Source Agreement 1.3",
  32366. true,
  32367. false
  32368. ],
  32369. "Naumen": [
  32370. "Naumen Public License",
  32371. true,
  32372. false
  32373. ],
  32374. "NBPL-1.0": [
  32375. "Net Boolean Public License v1",
  32376. false,
  32377. false
  32378. ],
  32379. "NCGL-UK-2.0": [
  32380. "Non-Commercial Government Licence",
  32381. false,
  32382. false
  32383. ],
  32384. "NCSA": [
  32385. "University of Illinois/NCSA Open Source License",
  32386. true,
  32387. false
  32388. ],
  32389. "Net-SNMP": [
  32390. "Net-SNMP License",
  32391. false,
  32392. false
  32393. ],
  32394. "NetCDF": [
  32395. "NetCDF license",
  32396. false,
  32397. false
  32398. ],
  32399. "Newsletr": [
  32400. "Newsletr License",
  32401. false,
  32402. false
  32403. ],
  32404. "NGPL": [
  32405. "Nethack General Public License",
  32406. true,
  32407. false
  32408. ],
  32409. "NLOD-1.0": [
  32410. "Norwegian Licence for Open Government Data",
  32411. false,
  32412. false
  32413. ],
  32414. "NLPL": [
  32415. "No Limit Public License",
  32416. false,
  32417. false
  32418. ],
  32419. "Nokia": [
  32420. "Nokia Open Source License",
  32421. true,
  32422. false
  32423. ],
  32424. "NOSL": [
  32425. "Netizen Open Source License",
  32426. false,
  32427. false
  32428. ],
  32429. "Noweb": [
  32430. "Noweb License",
  32431. false,
  32432. false
  32433. ],
  32434. "NPL-1.0": [
  32435. "Netscape Public License v1.0",
  32436. false,
  32437. false
  32438. ],
  32439. "NPL-1.1": [
  32440. "Netscape Public License v1.1",
  32441. false,
  32442. false
  32443. ],
  32444. "NPOSL-3.0": [
  32445. "Non-Profit Open Software License 3.0",
  32446. true,
  32447. false
  32448. ],
  32449. "NRL": [
  32450. "NRL License",
  32451. false,
  32452. false
  32453. ],
  32454. "NTP": [
  32455. "NTP License",
  32456. true,
  32457. false
  32458. ],
  32459. "NTP-0": [
  32460. "NTP No Attribution",
  32461. false,
  32462. false
  32463. ],
  32464. "Nunit": [
  32465. "Nunit License",
  32466. false,
  32467. true
  32468. ],
  32469. "O-UDA-1.0": [
  32470. "Open Use of Data Agreement v1.0",
  32471. false,
  32472. false
  32473. ],
  32474. "OCCT-PL": [
  32475. "Open CASCADE Technology Public License",
  32476. false,
  32477. false
  32478. ],
  32479. "OCLC-2.0": [
  32480. "OCLC Research Public License 2.0",
  32481. true,
  32482. false
  32483. ],
  32484. "ODbL-1.0": [
  32485. "ODC Open Database License v1.0",
  32486. false,
  32487. false
  32488. ],
  32489. "ODC-By-1.0": [
  32490. "Open Data Commons Attribution License v1.0",
  32491. false,
  32492. false
  32493. ],
  32494. "OFL-1.0": [
  32495. "SIL Open Font License 1.0",
  32496. false,
  32497. false
  32498. ],
  32499. "OFL-1.0-no-RFN": [
  32500. "SIL Open Font License 1.0 with no Reserved Font Name",
  32501. false,
  32502. false
  32503. ],
  32504. "OFL-1.0-RFN": [
  32505. "SIL Open Font License 1.0 with Reserved Font Name",
  32506. false,
  32507. false
  32508. ],
  32509. "OFL-1.1": [
  32510. "SIL Open Font License 1.1",
  32511. true,
  32512. false
  32513. ],
  32514. "OFL-1.1-no-RFN": [
  32515. "SIL Open Font License 1.1 with no Reserved Font Name",
  32516. true,
  32517. false
  32518. ],
  32519. "OFL-1.1-RFN": [
  32520. "SIL Open Font License 1.1 with Reserved Font Name",
  32521. true,
  32522. false
  32523. ],
  32524. "OGC-1.0": [
  32525. "OGC Software License, Version 1.0",
  32526. false,
  32527. false
  32528. ],
  32529. "OGL-Canada-2.0": [
  32530. "Open Government Licence - Canada",
  32531. false,
  32532. false
  32533. ],
  32534. "OGL-UK-1.0": [
  32535. "Open Government Licence v1.0",
  32536. false,
  32537. false
  32538. ],
  32539. "OGL-UK-2.0": [
  32540. "Open Government Licence v2.0",
  32541. false,
  32542. false
  32543. ],
  32544. "OGL-UK-3.0": [
  32545. "Open Government Licence v3.0",
  32546. false,
  32547. false
  32548. ],
  32549. "OGTSL": [
  32550. "Open Group Test Suite License",
  32551. true,
  32552. false
  32553. ],
  32554. "OLDAP-1.1": [
  32555. "Open LDAP Public License v1.1",
  32556. false,
  32557. false
  32558. ],
  32559. "OLDAP-1.2": [
  32560. "Open LDAP Public License v1.2",
  32561. false,
  32562. false
  32563. ],
  32564. "OLDAP-1.3": [
  32565. "Open LDAP Public License v1.3",
  32566. false,
  32567. false
  32568. ],
  32569. "OLDAP-1.4": [
  32570. "Open LDAP Public License v1.4",
  32571. false,
  32572. false
  32573. ],
  32574. "OLDAP-2.0": [
  32575. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  32576. false,
  32577. false
  32578. ],
  32579. "OLDAP-2.0.1": [
  32580. "Open LDAP Public License v2.0.1",
  32581. false,
  32582. false
  32583. ],
  32584. "OLDAP-2.1": [
  32585. "Open LDAP Public License v2.1",
  32586. false,
  32587. false
  32588. ],
  32589. "OLDAP-2.2": [
  32590. "Open LDAP Public License v2.2",
  32591. false,
  32592. false
  32593. ],
  32594. "OLDAP-2.2.1": [
  32595. "Open LDAP Public License v2.2.1",
  32596. false,
  32597. false
  32598. ],
  32599. "OLDAP-2.2.2": [
  32600. "Open LDAP Public License 2.2.2",
  32601. false,
  32602. false
  32603. ],
  32604. "OLDAP-2.3": [
  32605. "Open LDAP Public License v2.3",
  32606. false,
  32607. false
  32608. ],
  32609. "OLDAP-2.4": [
  32610. "Open LDAP Public License v2.4",
  32611. false,
  32612. false
  32613. ],
  32614. "OLDAP-2.5": [
  32615. "Open LDAP Public License v2.5",
  32616. false,
  32617. false
  32618. ],
  32619. "OLDAP-2.6": [
  32620. "Open LDAP Public License v2.6",
  32621. false,
  32622. false
  32623. ],
  32624. "OLDAP-2.7": [
  32625. "Open LDAP Public License v2.7",
  32626. false,
  32627. false
  32628. ],
  32629. "OLDAP-2.8": [
  32630. "Open LDAP Public License v2.8",
  32631. false,
  32632. false
  32633. ],
  32634. "OML": [
  32635. "Open Market License",
  32636. false,
  32637. false
  32638. ],
  32639. "OpenSSL": [
  32640. "OpenSSL License",
  32641. false,
  32642. false
  32643. ],
  32644. "OPL-1.0": [
  32645. "Open Public License v1.0",
  32646. false,
  32647. false
  32648. ],
  32649. "OSET-PL-2.1": [
  32650. "OSET Public License version 2.1",
  32651. true,
  32652. false
  32653. ],
  32654. "OSL-1.0": [
  32655. "Open Software License 1.0",
  32656. true,
  32657. false
  32658. ],
  32659. "OSL-1.1": [
  32660. "Open Software License 1.1",
  32661. false,
  32662. false
  32663. ],
  32664. "OSL-2.0": [
  32665. "Open Software License 2.0",
  32666. true,
  32667. false
  32668. ],
  32669. "OSL-2.1": [
  32670. "Open Software License 2.1",
  32671. true,
  32672. false
  32673. ],
  32674. "OSL-3.0": [
  32675. "Open Software License 3.0",
  32676. true,
  32677. false
  32678. ],
  32679. "Parity-6.0.0": [
  32680. "The Parity Public License 6.0.0",
  32681. false,
  32682. false
  32683. ],
  32684. "Parity-7.0.0": [
  32685. "The Parity Public License 7.0.0",
  32686. false,
  32687. false
  32688. ],
  32689. "PDDL-1.0": [
  32690. "ODC Public Domain Dedication & License 1.0",
  32691. false,
  32692. false
  32693. ],
  32694. "PHP-3.0": [
  32695. "PHP License v3.0",
  32696. true,
  32697. false
  32698. ],
  32699. "PHP-3.01": [
  32700. "PHP License v3.01",
  32701. false,
  32702. false
  32703. ],
  32704. "Plexus": [
  32705. "Plexus Classworlds License",
  32706. false,
  32707. false
  32708. ],
  32709. "PolyForm-Noncommercial-1.0.0": [
  32710. "PolyForm Noncommercial License 1.0.0",
  32711. false,
  32712. false
  32713. ],
  32714. "PolyForm-Small-Business-1.0.0": [
  32715. "PolyForm Small Business License 1.0.0",
  32716. false,
  32717. false
  32718. ],
  32719. "PostgreSQL": [
  32720. "PostgreSQL License",
  32721. true,
  32722. false
  32723. ],
  32724. "PSF-2.0": [
  32725. "Python Software Foundation License 2.0",
  32726. false,
  32727. false
  32728. ],
  32729. "psfrag": [
  32730. "psfrag License",
  32731. false,
  32732. false
  32733. ],
  32734. "psutils": [
  32735. "psutils License",
  32736. false,
  32737. false
  32738. ],
  32739. "Python-2.0": [
  32740. "Python License 2.0",
  32741. true,
  32742. false
  32743. ],
  32744. "Qhull": [
  32745. "Qhull License",
  32746. false,
  32747. false
  32748. ],
  32749. "QPL-1.0": [
  32750. "Q Public License 1.0",
  32751. true,
  32752. false
  32753. ],
  32754. "Rdisc": [
  32755. "Rdisc License",
  32756. false,
  32757. false
  32758. ],
  32759. "RHeCos-1.1": [
  32760. "Red Hat eCos Public License v1.1",
  32761. false,
  32762. false
  32763. ],
  32764. "RPL-1.1": [
  32765. "Reciprocal Public License 1.1",
  32766. true,
  32767. false
  32768. ],
  32769. "RPL-1.5": [
  32770. "Reciprocal Public License 1.5",
  32771. true,
  32772. false
  32773. ],
  32774. "RPSL-1.0": [
  32775. "RealNetworks Public Source License v1.0",
  32776. true,
  32777. false
  32778. ],
  32779. "RSA-MD": [
  32780. "RSA Message-Digest License",
  32781. false,
  32782. false
  32783. ],
  32784. "RSCPL": [
  32785. "Ricoh Source Code Public License",
  32786. true,
  32787. false
  32788. ],
  32789. "Ruby": [
  32790. "Ruby License",
  32791. false,
  32792. false
  32793. ],
  32794. "SAX-PD": [
  32795. "Sax Public Domain Notice",
  32796. false,
  32797. false
  32798. ],
  32799. "Saxpath": [
  32800. "Saxpath License",
  32801. false,
  32802. false
  32803. ],
  32804. "SCEA": [
  32805. "SCEA Shared Source License",
  32806. false,
  32807. false
  32808. ],
  32809. "Sendmail": [
  32810. "Sendmail License",
  32811. false,
  32812. false
  32813. ],
  32814. "Sendmail-8.23": [
  32815. "Sendmail License 8.23",
  32816. false,
  32817. false
  32818. ],
  32819. "SGI-B-1.0": [
  32820. "SGI Free Software License B v1.0",
  32821. false,
  32822. false
  32823. ],
  32824. "SGI-B-1.1": [
  32825. "SGI Free Software License B v1.1",
  32826. false,
  32827. false
  32828. ],
  32829. "SGI-B-2.0": [
  32830. "SGI Free Software License B v2.0",
  32831. false,
  32832. false
  32833. ],
  32834. "SHL-0.5": [
  32835. "Solderpad Hardware License v0.5",
  32836. false,
  32837. false
  32838. ],
  32839. "SHL-0.51": [
  32840. "Solderpad Hardware License, Version 0.51",
  32841. false,
  32842. false
  32843. ],
  32844. "SimPL-2.0": [
  32845. "Simple Public License 2.0",
  32846. true,
  32847. false
  32848. ],
  32849. "SISSL": [
  32850. "Sun Industry Standards Source License v1.1",
  32851. true,
  32852. false
  32853. ],
  32854. "SISSL-1.2": [
  32855. "Sun Industry Standards Source License v1.2",
  32856. false,
  32857. false
  32858. ],
  32859. "Sleepycat": [
  32860. "Sleepycat License",
  32861. true,
  32862. false
  32863. ],
  32864. "SMLNJ": [
  32865. "Standard ML of New Jersey License",
  32866. false,
  32867. false
  32868. ],
  32869. "SMPPL": [
  32870. "Secure Messaging Protocol Public License",
  32871. false,
  32872. false
  32873. ],
  32874. "SNIA": [
  32875. "SNIA Public License 1.1",
  32876. false,
  32877. false
  32878. ],
  32879. "Spencer-86": [
  32880. "Spencer License 86",
  32881. false,
  32882. false
  32883. ],
  32884. "Spencer-94": [
  32885. "Spencer License 94",
  32886. false,
  32887. false
  32888. ],
  32889. "Spencer-99": [
  32890. "Spencer License 99",
  32891. false,
  32892. false
  32893. ],
  32894. "SPL-1.0": [
  32895. "Sun Public License v1.0",
  32896. true,
  32897. false
  32898. ],
  32899. "SSH-OpenSSH": [
  32900. "SSH OpenSSH license",
  32901. false,
  32902. false
  32903. ],
  32904. "SSH-short": [
  32905. "SSH short notice",
  32906. false,
  32907. false
  32908. ],
  32909. "SSPL-1.0": [
  32910. "Server Side Public License, v 1",
  32911. false,
  32912. false
  32913. ],
  32914. "StandardML-NJ": [
  32915. "Standard ML of New Jersey License",
  32916. false,
  32917. true
  32918. ],
  32919. "SugarCRM-1.1.3": [
  32920. "SugarCRM Public License v1.1.3",
  32921. false,
  32922. false
  32923. ],
  32924. "SWL": [
  32925. "Scheme Widget Library (SWL) Software License Agreement",
  32926. false,
  32927. false
  32928. ],
  32929. "TAPR-OHL-1.0": [
  32930. "TAPR Open Hardware License v1.0",
  32931. false,
  32932. false
  32933. ],
  32934. "TCL": [
  32935. "TCL/TK License",
  32936. false,
  32937. false
  32938. ],
  32939. "TCP-wrappers": [
  32940. "TCP Wrappers License",
  32941. false,
  32942. false
  32943. ],
  32944. "TMate": [
  32945. "TMate Open Source License",
  32946. false,
  32947. false
  32948. ],
  32949. "TORQUE-1.1": [
  32950. "TORQUE v2.5+ Software License v1.1",
  32951. false,
  32952. false
  32953. ],
  32954. "TOSL": [
  32955. "Trusster Open Source License",
  32956. false,
  32957. false
  32958. ],
  32959. "TU-Berlin-1.0": [
  32960. "Technische Universitaet Berlin License 1.0",
  32961. false,
  32962. false
  32963. ],
  32964. "TU-Berlin-2.0": [
  32965. "Technische Universitaet Berlin License 2.0",
  32966. false,
  32967. false
  32968. ],
  32969. "UCL-1.0": [
  32970. "Upstream Compatibility License v1.0",
  32971. true,
  32972. false
  32973. ],
  32974. "Unicode-DFS-2015": [
  32975. "Unicode License Agreement - Data Files and Software (2015)",
  32976. false,
  32977. false
  32978. ],
  32979. "Unicode-DFS-2016": [
  32980. "Unicode License Agreement - Data Files and Software (2016)",
  32981. false,
  32982. false
  32983. ],
  32984. "Unicode-TOU": [
  32985. "Unicode Terms of Use",
  32986. false,
  32987. false
  32988. ],
  32989. "Unlicense": [
  32990. "The Unlicense",
  32991. false,
  32992. false
  32993. ],
  32994. "UPL-1.0": [
  32995. "Universal Permissive License v1.0",
  32996. true,
  32997. false
  32998. ],
  32999. "Vim": [
  33000. "Vim License",
  33001. false,
  33002. false
  33003. ],
  33004. "VOSTROM": [
  33005. "VOSTROM Public License for Open Source",
  33006. false,
  33007. false
  33008. ],
  33009. "VSL-1.0": [
  33010. "Vovida Software License v1.0",
  33011. true,
  33012. false
  33013. ],
  33014. "W3C": [
  33015. "W3C Software Notice and License (2002-12-31)",
  33016. true,
  33017. false
  33018. ],
  33019. "W3C-19980720": [
  33020. "W3C Software Notice and License (1998-07-20)",
  33021. false,
  33022. false
  33023. ],
  33024. "W3C-20150513": [
  33025. "W3C Software Notice and Document License (2015-05-13)",
  33026. false,
  33027. false
  33028. ],
  33029. "Watcom-1.0": [
  33030. "Sybase Open Watcom Public License 1.0",
  33031. true,
  33032. false
  33033. ],
  33034. "Wsuipa": [
  33035. "Wsuipa License",
  33036. false,
  33037. false
  33038. ],
  33039. "WTFPL": [
  33040. "Do What The F*ck You Want To Public License",
  33041. false,
  33042. false
  33043. ],
  33044. "wxWindows": [
  33045. "wxWindows Library License",
  33046. false,
  33047. true
  33048. ],
  33049. "X11": [
  33050. "X11 License",
  33051. false,
  33052. false
  33053. ],
  33054. "Xerox": [
  33055. "Xerox License",
  33056. false,
  33057. false
  33058. ],
  33059. "XFree86-1.1": [
  33060. "XFree86 License 1.1",
  33061. false,
  33062. false
  33063. ],
  33064. "xinetd": [
  33065. "xinetd License",
  33066. false,
  33067. false
  33068. ],
  33069. "Xnet": [
  33070. "X.Net License",
  33071. true,
  33072. false
  33073. ],
  33074. "xpp": [
  33075. "XPP License",
  33076. false,
  33077. false
  33078. ],
  33079. "XSkat": [
  33080. "XSkat License",
  33081. false,
  33082. false
  33083. ],
  33084. "YPL-1.0": [
  33085. "Yahoo! Public License v1.0",
  33086. false,
  33087. false
  33088. ],
  33089. "YPL-1.1": [
  33090. "Yahoo! Public License v1.1",
  33091. false,
  33092. false
  33093. ],
  33094. "Zed": [
  33095. "Zed License",
  33096. false,
  33097. false
  33098. ],
  33099. "Zend-2.0": [
  33100. "Zend License v2.0",
  33101. false,
  33102. false
  33103. ],
  33104. "Zimbra-1.3": [
  33105. "Zimbra Public License v1.3",
  33106. false,
  33107. false
  33108. ],
  33109. "Zimbra-1.4": [
  33110. "Zimbra Public License v1.4",
  33111. false,
  33112. false
  33113. ],
  33114. "Zlib": [
  33115. "zlib License",
  33116. true,
  33117. false
  33118. ],
  33119. "zlib-acknowledgement": [
  33120. "zlib/libpng License with Acknowledgement",
  33121. false,
  33122. false
  33123. ],
  33124. "ZPL-1.1": [
  33125. "Zope Public License 1.1",
  33126. false,
  33127. false
  33128. ],
  33129. "ZPL-2.0": [
  33130. "Zope Public License 2.0",
  33131. true,
  33132. false
  33133. ],
  33134. "ZPL-2.1": [
  33135. "Zope Public License 2.1",
  33136. false,
  33137. false
  33138. ]
  33139. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  33140. $�������Æ,Í;§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��������à�  ��
  33141. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  33142. ����������������� ��`.rdata����� ���
  33143. �����������������@��@.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
  33144. 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
  33145. 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
  33146. 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">
  33147. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  33148. <security>
  33149. <requestedPrivileges>
  33150. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  33151. </requestedPrivileges>
  33152. </security>
  33153. </trustInfo>
  33154. <dependency>
  33155. <dependentAssembly>
  33156. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  33157. </dependentAssembly>
  33158. </dependency>
  33159. </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��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  33160. namespace Symfony\Component\Console;
  33161. use Symfony\Component\Console\Command\Command;
  33162. use Symfony\Component\Console\Command\HelpCommand;
  33163. use Symfony\Component\Console\Command\ListCommand;
  33164. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33165. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33166. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  33167. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  33168. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  33169. use Symfony\Component\Console\Exception\CommandNotFoundException;
  33170. use Symfony\Component\Console\Exception\ExceptionInterface;
  33171. use Symfony\Component\Console\Exception\LogicException;
  33172. use Symfony\Component\Console\Formatter\OutputFormatter;
  33173. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  33174. use Symfony\Component\Console\Helper\DialogHelper;
  33175. use Symfony\Component\Console\Helper\FormatterHelper;
  33176. use Symfony\Component\Console\Helper\Helper;
  33177. use Symfony\Component\Console\Helper\HelperSet;
  33178. use Symfony\Component\Console\Helper\ProcessHelper;
  33179. use Symfony\Component\Console\Helper\ProgressHelper;
  33180. use Symfony\Component\Console\Helper\QuestionHelper;
  33181. use Symfony\Component\Console\Helper\TableHelper;
  33182. use Symfony\Component\Console\Input\ArgvInput;
  33183. use Symfony\Component\Console\Input\ArrayInput;
  33184. use Symfony\Component\Console\Input\InputArgument;
  33185. use Symfony\Component\Console\Input\InputAwareInterface;
  33186. use Symfony\Component\Console\Input\InputDefinition;
  33187. use Symfony\Component\Console\Input\InputInterface;
  33188. use Symfony\Component\Console\Input\InputOption;
  33189. use Symfony\Component\Console\Output\BufferedOutput;
  33190. use Symfony\Component\Console\Output\ConsoleOutput;
  33191. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33192. use Symfony\Component\Console\Output\OutputInterface;
  33193. use Symfony\Component\Debug\Exception\FatalThrowableError;
  33194. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  33195. class Application
  33196. {
  33197. private $commands = array();
  33198. private $wantHelps = false;
  33199. private $runningCommand;
  33200. private $name;
  33201. private $version;
  33202. private $catchExceptions = true;
  33203. private $autoExit = true;
  33204. private $definition;
  33205. private $helperSet;
  33206. private $dispatcher;
  33207. private $terminalDimensions;
  33208. private $defaultCommand;
  33209. private $initialized;
  33210. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  33211. {
  33212. $this->name = $name;
  33213. $this->version = $version;
  33214. $this->defaultCommand = 'list';
  33215. }
  33216. public function setDispatcher(EventDispatcherInterface $dispatcher)
  33217. {
  33218. $this->dispatcher = $dispatcher;
  33219. }
  33220. public function run(InputInterface $input = null, OutputInterface $output = null)
  33221. {
  33222. if (null === $input) {
  33223. $input = new ArgvInput();
  33224. }
  33225. if (null === $output) {
  33226. $output = new ConsoleOutput();
  33227. }
  33228. $this->configureIO($input, $output);
  33229. try {
  33230. $e = null;
  33231. $exitCode = $this->doRun($input, $output);
  33232. } catch (\Exception $e) {
  33233. }
  33234. if (null !== $e) {
  33235. if (!$this->catchExceptions) {
  33236. throw $e;
  33237. }
  33238. if ($output instanceof ConsoleOutputInterface) {
  33239. $this->renderException($e, $output->getErrorOutput());
  33240. } else {
  33241. $this->renderException($e, $output);
  33242. }
  33243. $exitCode = $this->getExitCodeForThrowable($e);
  33244. }
  33245. if ($this->autoExit) {
  33246. if ($exitCode > 255) {
  33247. $exitCode = 255;
  33248. }
  33249. exit($exitCode);
  33250. }
  33251. return $exitCode;
  33252. }
  33253. public function doRun(InputInterface $input, OutputInterface $output)
  33254. {
  33255. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  33256. $output->writeln($this->getLongVersion());
  33257. return 0;
  33258. }
  33259. $name = $this->getCommandName($input);
  33260. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  33261. if (!$name) {
  33262. $name = 'help';
  33263. $input = new ArrayInput(array('command' => 'help'));
  33264. } else {
  33265. $this->wantHelps = true;
  33266. }
  33267. }
  33268. if (!$name) {
  33269. $name = $this->defaultCommand;
  33270. $definition = $this->getDefinition();
  33271. $definition->setArguments(array_merge(
  33272. $definition->getArguments(),
  33273. array(
  33274. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  33275. )
  33276. ));
  33277. }
  33278. $this->runningCommand = null;
  33279. $command = $this->find($name);
  33280. $this->runningCommand = $command;
  33281. $exitCode = $this->doRunCommand($command, $input, $output);
  33282. $this->runningCommand = null;
  33283. return $exitCode;
  33284. }
  33285. public function setHelperSet(HelperSet $helperSet)
  33286. {
  33287. $this->helperSet = $helperSet;
  33288. }
  33289. public function getHelperSet()
  33290. {
  33291. if (!$this->helperSet) {
  33292. $this->helperSet = $this->getDefaultHelperSet();
  33293. }
  33294. return $this->helperSet;
  33295. }
  33296. public function setDefinition(InputDefinition $definition)
  33297. {
  33298. $this->definition = $definition;
  33299. }
  33300. public function getDefinition()
  33301. {
  33302. if (!$this->definition) {
  33303. $this->definition = $this->getDefaultInputDefinition();
  33304. }
  33305. return $this->definition;
  33306. }
  33307. public function getHelp()
  33308. {
  33309. return $this->getLongVersion();
  33310. }
  33311. public function setCatchExceptions($boolean)
  33312. {
  33313. $this->catchExceptions = (bool) $boolean;
  33314. }
  33315. public function setAutoExit($boolean)
  33316. {
  33317. $this->autoExit = (bool) $boolean;
  33318. }
  33319. public function getName()
  33320. {
  33321. return $this->name;
  33322. }
  33323. public function setName($name)
  33324. {
  33325. $this->name = $name;
  33326. }
  33327. public function getVersion()
  33328. {
  33329. return $this->version;
  33330. }
  33331. public function setVersion($version)
  33332. {
  33333. $this->version = $version;
  33334. }
  33335. public function getLongVersion()
  33336. {
  33337. if ('UNKNOWN' !== $this->getName()) {
  33338. if ('UNKNOWN' !== $this->getVersion()) {
  33339. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  33340. }
  33341. return sprintf('<info>%s</info>', $this->getName());
  33342. }
  33343. return '<info>Console Tool</info>';
  33344. }
  33345. public function register($name)
  33346. {
  33347. return $this->add(new Command($name));
  33348. }
  33349. public function addCommands(array $commands)
  33350. {
  33351. foreach ($commands as $command) {
  33352. $this->add($command);
  33353. }
  33354. }
  33355. public function add(Command $command)
  33356. {
  33357. $this->init();
  33358. $command->setApplication($this);
  33359. if (!$command->isEnabled()) {
  33360. $command->setApplication(null);
  33361. return;
  33362. }
  33363. if (null === $command->getDefinition()) {
  33364. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  33365. }
  33366. $this->commands[$command->getName()] = $command;
  33367. foreach ($command->getAliases() as $alias) {
  33368. $this->commands[$alias] = $command;
  33369. }
  33370. return $command;
  33371. }
  33372. public function get($name)
  33373. {
  33374. $this->init();
  33375. if (!isset($this->commands[$name])) {
  33376. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  33377. }
  33378. $command = $this->commands[$name];
  33379. if ($this->wantHelps) {
  33380. $this->wantHelps = false;
  33381. $helpCommand = $this->get('help');
  33382. $helpCommand->setCommand($command);
  33383. return $helpCommand;
  33384. }
  33385. return $command;
  33386. }
  33387. public function has($name)
  33388. {
  33389. $this->init();
  33390. return isset($this->commands[$name]);
  33391. }
  33392. public function getNamespaces()
  33393. {
  33394. $namespaces = array();
  33395. foreach ($this->all() as $command) {
  33396. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  33397. foreach ($command->getAliases() as $alias) {
  33398. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  33399. }
  33400. }
  33401. return array_values(array_unique(array_filter($namespaces)));
  33402. }
  33403. public function findNamespace($namespace)
  33404. {
  33405. $allNamespaces = $this->getNamespaces();
  33406. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  33407. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  33408. if (empty($namespaces)) {
  33409. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  33410. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  33411. if (1 == \count($alternatives)) {
  33412. $message .= "\n\nDid you mean this?\n ";
  33413. } else {
  33414. $message .= "\n\nDid you mean one of these?\n ";
  33415. }
  33416. $message .= implode("\n ", $alternatives);
  33417. }
  33418. throw new CommandNotFoundException($message, $alternatives);
  33419. }
  33420. $exact = \in_array($namespace, $namespaces, true);
  33421. if (\count($namespaces) > 1 && !$exact) {
  33422. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  33423. }
  33424. return $exact ? $namespace : reset($namespaces);
  33425. }
  33426. public function find($name)
  33427. {
  33428. $this->init();
  33429. $aliases = array();
  33430. $allCommands = array_keys($this->commands);
  33431. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  33432. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  33433. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  33434. if (false !== $pos = strrpos($name, ':')) {
  33435. $this->findNamespace(substr($name, 0, $pos));
  33436. }
  33437. $message = sprintf('Command "%s" is not defined.', $name);
  33438. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  33439. if (1 == \count($alternatives)) {
  33440. $message .= "\n\nDid you mean this?\n ";
  33441. } else {
  33442. $message .= "\n\nDid you mean one of these?\n ";
  33443. }
  33444. $message .= implode("\n ", $alternatives);
  33445. }
  33446. throw new CommandNotFoundException($message, $alternatives);
  33447. }
  33448. if (\count($commands) > 1) {
  33449. $commandList = $this->commands;
  33450. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  33451. $commandName = $commandList[$nameOrAlias]->getName();
  33452. $aliases[$nameOrAlias] = $commandName;
  33453. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  33454. });
  33455. }
  33456. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  33457. if (!$exact && \count($commands) > 1) {
  33458. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  33459. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  33460. }
  33461. return $this->get($exact ? $name : reset($commands));
  33462. }
  33463. public function all($namespace = null)
  33464. {
  33465. $this->init();
  33466. if (null === $namespace) {
  33467. return $this->commands;
  33468. }
  33469. $commands = array();
  33470. foreach ($this->commands as $name => $command) {
  33471. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  33472. $commands[$name] = $command;
  33473. }
  33474. }
  33475. return $commands;
  33476. }
  33477. public static function getAbbreviations($names)
  33478. {
  33479. $abbrevs = array();
  33480. foreach ($names as $name) {
  33481. for ($len = \strlen($name); $len > 0; --$len) {
  33482. $abbrev = substr($name, 0, $len);
  33483. $abbrevs[$abbrev][] = $name;
  33484. }
  33485. }
  33486. return $abbrevs;
  33487. }
  33488. public function asText($namespace = null, $raw = false)
  33489. {
  33490. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33491. $descriptor = new TextDescriptor();
  33492. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  33493. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  33494. return $output->fetch();
  33495. }
  33496. public function asXml($namespace = null, $asDom = false)
  33497. {
  33498. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33499. $descriptor = new XmlDescriptor();
  33500. if ($asDom) {
  33501. return $descriptor->getApplicationDocument($this, $namespace);
  33502. }
  33503. $output = new BufferedOutput();
  33504. $descriptor->describe($output, $this, array('namespace' => $namespace));
  33505. return $output->fetch();
  33506. }
  33507. public function renderException($e, $output)
  33508. {
  33509. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33510. do {
  33511. $title = sprintf(' [%s] ', \get_class($e));
  33512. $len = Helper::strlen($title);
  33513. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  33514. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  33515. $width = 1 << 31;
  33516. }
  33517. $lines = array();
  33518. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  33519. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  33520. $lineLength = Helper::strlen($line) + 4;
  33521. $lines[] = array($line, $lineLength);
  33522. $len = max($lineLength, $len);
  33523. }
  33524. }
  33525. $messages = array();
  33526. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  33527. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  33528. foreach ($lines as $line) {
  33529. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  33530. }
  33531. $messages[] = $emptyLine;
  33532. $messages[] = '';
  33533. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  33534. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  33535. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  33536. $trace = $e->getTrace();
  33537. array_unshift($trace, array(
  33538. 'function' => '',
  33539. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  33540. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  33541. 'args' => array(),
  33542. ));
  33543. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  33544. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  33545. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  33546. $function = $trace[$i]['function'];
  33547. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  33548. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  33549. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  33550. }
  33551. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33552. }
  33553. } while ($e = $e->getPrevious());
  33554. if (null !== $this->runningCommand) {
  33555. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  33556. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33557. }
  33558. }
  33559. protected function getTerminalWidth()
  33560. {
  33561. $dimensions = $this->getTerminalDimensions();
  33562. return $dimensions[0];
  33563. }
  33564. protected function getTerminalHeight()
  33565. {
  33566. $dimensions = $this->getTerminalDimensions();
  33567. return $dimensions[1];
  33568. }
  33569. public function getTerminalDimensions()
  33570. {
  33571. if ($this->terminalDimensions) {
  33572. return $this->terminalDimensions;
  33573. }
  33574. if ('\\' === \DIRECTORY_SEPARATOR) {
  33575. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  33576. return array((int) $matches[1], (int) $matches[2]);
  33577. }
  33578. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  33579. return array((int) $matches[1], (int) $matches[2]);
  33580. }
  33581. }
  33582. if ($sttyString = $this->getSttyColumns()) {
  33583. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  33584. return array((int) $matches[2], (int) $matches[1]);
  33585. }
  33586. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  33587. return array((int) $matches[2], (int) $matches[1]);
  33588. }
  33589. }
  33590. return array(null, null);
  33591. }
  33592. public function setTerminalDimensions($width, $height)
  33593. {
  33594. $this->terminalDimensions = array($width, $height);
  33595. return $this;
  33596. }
  33597. protected function configureIO(InputInterface $input, OutputInterface $output)
  33598. {
  33599. if (true === $input->hasParameterOption(array('--ansi'))) {
  33600. $output->setDecorated(true);
  33601. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  33602. $output->setDecorated(false);
  33603. }
  33604. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  33605. $input->setInteractive(false);
  33606. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  33607. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  33608. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  33609. $input->setInteractive(false);
  33610. }
  33611. }
  33612. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  33613. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  33614. $input->setInteractive(false);
  33615. } else {
  33616. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  33617. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  33618. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  33619. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  33620. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  33621. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  33622. }
  33623. }
  33624. }
  33625. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  33626. {
  33627. foreach ($command->getHelperSet() as $helper) {
  33628. if ($helper instanceof InputAwareInterface) {
  33629. $helper->setInput($input);
  33630. }
  33631. }
  33632. if (null === $this->dispatcher) {
  33633. return $command->run($input, $output);
  33634. }
  33635. try {
  33636. $command->mergeApplicationDefinition();
  33637. $input->bind($command->getDefinition());
  33638. } catch (ExceptionInterface $e) {
  33639. }
  33640. $event = new ConsoleCommandEvent($command, $input, $output);
  33641. $e = null;
  33642. try {
  33643. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  33644. if ($event->commandShouldRun()) {
  33645. $exitCode = $command->run($input, $output);
  33646. } else {
  33647. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  33648. }
  33649. } catch (\Exception $e) {
  33650. } catch (\Throwable $e) {
  33651. }
  33652. if (null !== $e) {
  33653. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  33654. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  33655. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  33656. if ($x !== $event->getException()) {
  33657. $e = $event->getException();
  33658. }
  33659. $exitCode = $this->getExitCodeForThrowable($e);
  33660. }
  33661. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  33662. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  33663. if (null !== $e) {
  33664. throw $e;
  33665. }
  33666. return $event->getExitCode();
  33667. }
  33668. protected function getCommandName(InputInterface $input)
  33669. {
  33670. return $input->getFirstArgument();
  33671. }
  33672. protected function getDefaultInputDefinition()
  33673. {
  33674. return new InputDefinition(array(
  33675. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  33676. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  33677. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  33678. 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'),
  33679. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  33680. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  33681. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  33682. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  33683. ));
  33684. }
  33685. protected function getDefaultCommands()
  33686. {
  33687. return array(new HelpCommand(), new ListCommand());
  33688. }
  33689. protected function getDefaultHelperSet()
  33690. {
  33691. return new HelperSet(array(
  33692. new FormatterHelper(),
  33693. new DialogHelper(false),
  33694. new ProgressHelper(false),
  33695. new TableHelper(false),
  33696. new DebugFormatterHelper(),
  33697. new ProcessHelper(),
  33698. new QuestionHelper(),
  33699. ));
  33700. }
  33701. private function getSttyColumns()
  33702. {
  33703. if (!\function_exists('proc_open')) {
  33704. return;
  33705. }
  33706. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33707. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33708. if (\is_resource($process)) {
  33709. $info = stream_get_contents($pipes[1]);
  33710. fclose($pipes[1]);
  33711. fclose($pipes[2]);
  33712. proc_close($process);
  33713. return $info;
  33714. }
  33715. }
  33716. private function getConsoleMode()
  33717. {
  33718. if (!\function_exists('proc_open')) {
  33719. return;
  33720. }
  33721. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33722. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33723. if (\is_resource($process)) {
  33724. $info = stream_get_contents($pipes[1]);
  33725. fclose($pipes[1]);
  33726. fclose($pipes[2]);
  33727. proc_close($process);
  33728. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  33729. return $matches[2].'x'.$matches[1];
  33730. }
  33731. }
  33732. }
  33733. private function getAbbreviationSuggestions($abbrevs)
  33734. {
  33735. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  33736. }
  33737. public function extractNamespace($name, $limit = null)
  33738. {
  33739. $parts = explode(':', $name);
  33740. array_pop($parts);
  33741. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  33742. }
  33743. private function findAlternatives($name, $collection)
  33744. {
  33745. $threshold = 1e3;
  33746. $alternatives = array();
  33747. $collectionParts = array();
  33748. foreach ($collection as $item) {
  33749. $collectionParts[$item] = explode(':', $item);
  33750. }
  33751. foreach (explode(':', $name) as $i => $subname) {
  33752. foreach ($collectionParts as $collectionName => $parts) {
  33753. $exists = isset($alternatives[$collectionName]);
  33754. if (!isset($parts[$i]) && $exists) {
  33755. $alternatives[$collectionName] += $threshold;
  33756. continue;
  33757. } elseif (!isset($parts[$i])) {
  33758. continue;
  33759. }
  33760. $lev = levenshtein($subname, $parts[$i]);
  33761. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  33762. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  33763. } elseif ($exists) {
  33764. $alternatives[$collectionName] += $threshold;
  33765. }
  33766. }
  33767. }
  33768. foreach ($collection as $item) {
  33769. $lev = levenshtein($name, $item);
  33770. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  33771. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  33772. }
  33773. }
  33774. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  33775. asort($alternatives);
  33776. return array_keys($alternatives);
  33777. }
  33778. public function setDefaultCommand($commandName)
  33779. {
  33780. $this->defaultCommand = $commandName;
  33781. }
  33782. private function splitStringByWidth($string, $width)
  33783. {
  33784. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33785. return str_split($string, $width);
  33786. }
  33787. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  33788. $lines = array();
  33789. $line = '';
  33790. foreach (preg_split('//u', $utf8String) as $char) {
  33791. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  33792. $line .= $char;
  33793. continue;
  33794. }
  33795. $lines[] = str_pad($line, $width);
  33796. $line = $char;
  33797. }
  33798. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  33799. mb_convert_variables($encoding, 'utf8', $lines);
  33800. return $lines;
  33801. }
  33802. private function extractAllNamespaces($name)
  33803. {
  33804. $parts = explode(':', $name, -1);
  33805. $namespaces = array();
  33806. foreach ($parts as $part) {
  33807. if (\count($namespaces)) {
  33808. $namespaces[] = end($namespaces).':'.$part;
  33809. } else {
  33810. $namespaces[] = $part;
  33811. }
  33812. }
  33813. return $namespaces;
  33814. }
  33815. private function init()
  33816. {
  33817. if ($this->initialized) {
  33818. return;
  33819. }
  33820. $this->initialized = true;
  33821. foreach ($this->getDefaultCommands() as $command) {
  33822. $this->add($command);
  33823. }
  33824. }
  33825. private function getExitCodeForThrowable($throwable)
  33826. {
  33827. $exitCode = $throwable->getCode();
  33828. if (is_numeric($exitCode)) {
  33829. $exitCode = (int) $exitCode;
  33830. if (0 === $exitCode) {
  33831. $exitCode = 1;
  33832. }
  33833. } else {
  33834. $exitCode = 1;
  33835. }
  33836. return $exitCode;
  33837. }
  33838. }
  33839. <?php
  33840. namespace Symfony\Component\Console\Command;
  33841. use Symfony\Component\Console\Application;
  33842. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33843. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33844. use Symfony\Component\Console\Exception\ExceptionInterface;
  33845. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33846. use Symfony\Component\Console\Exception\LogicException;
  33847. use Symfony\Component\Console\Helper\HelperSet;
  33848. use Symfony\Component\Console\Input\InputArgument;
  33849. use Symfony\Component\Console\Input\InputDefinition;
  33850. use Symfony\Component\Console\Input\InputInterface;
  33851. use Symfony\Component\Console\Input\InputOption;
  33852. use Symfony\Component\Console\Output\BufferedOutput;
  33853. use Symfony\Component\Console\Output\OutputInterface;
  33854. class Command
  33855. {
  33856. private $application;
  33857. private $name;
  33858. private $processTitle;
  33859. private $aliases = array();
  33860. private $definition;
  33861. private $help;
  33862. private $description;
  33863. private $ignoreValidationErrors = false;
  33864. private $applicationDefinitionMerged = false;
  33865. private $applicationDefinitionMergedWithArgs = false;
  33866. private $code;
  33867. private $synopsis = array();
  33868. private $usages = array();
  33869. private $helperSet;
  33870. public function __construct($name = null)
  33871. {
  33872. $this->definition = new InputDefinition();
  33873. if (null !== $name) {
  33874. $this->setName($name);
  33875. }
  33876. $this->configure();
  33877. if (!$this->name) {
  33878. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  33879. }
  33880. }
  33881. public function ignoreValidationErrors()
  33882. {
  33883. $this->ignoreValidationErrors = true;
  33884. }
  33885. public function setApplication(Application $application = null)
  33886. {
  33887. $this->application = $application;
  33888. if ($application) {
  33889. $this->setHelperSet($application->getHelperSet());
  33890. } else {
  33891. $this->helperSet = null;
  33892. }
  33893. }
  33894. public function setHelperSet(HelperSet $helperSet)
  33895. {
  33896. $this->helperSet = $helperSet;
  33897. }
  33898. public function getHelperSet()
  33899. {
  33900. return $this->helperSet;
  33901. }
  33902. public function getApplication()
  33903. {
  33904. return $this->application;
  33905. }
  33906. public function isEnabled()
  33907. {
  33908. return true;
  33909. }
  33910. protected function configure()
  33911. {
  33912. }
  33913. protected function execute(InputInterface $input, OutputInterface $output)
  33914. {
  33915. throw new LogicException('You must override the execute() method in the concrete command class.');
  33916. }
  33917. protected function interact(InputInterface $input, OutputInterface $output)
  33918. {
  33919. }
  33920. protected function initialize(InputInterface $input, OutputInterface $output)
  33921. {
  33922. }
  33923. public function run(InputInterface $input, OutputInterface $output)
  33924. {
  33925. $this->getSynopsis(true);
  33926. $this->getSynopsis(false);
  33927. $this->mergeApplicationDefinition();
  33928. try {
  33929. $input->bind($this->definition);
  33930. } catch (ExceptionInterface $e) {
  33931. if (!$this->ignoreValidationErrors) {
  33932. throw $e;
  33933. }
  33934. }
  33935. $this->initialize($input, $output);
  33936. if (null !== $this->processTitle) {
  33937. if (\function_exists('cli_set_process_title')) {
  33938. if (!@cli_set_process_title($this->processTitle)) {
  33939. if ('Darwin' === PHP_OS) {
  33940. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  33941. } else {
  33942. cli_set_process_title($this->processTitle);
  33943. }
  33944. }
  33945. } elseif (\function_exists('setproctitle')) {
  33946. setproctitle($this->processTitle);
  33947. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  33948. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  33949. }
  33950. }
  33951. if ($input->isInteractive()) {
  33952. $this->interact($input, $output);
  33953. }
  33954. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  33955. $input->setArgument('command', $this->getName());
  33956. }
  33957. $input->validate();
  33958. if ($this->code) {
  33959. $statusCode = \call_user_func($this->code, $input, $output);
  33960. } else {
  33961. $statusCode = $this->execute($input, $output);
  33962. }
  33963. return is_numeric($statusCode) ? (int) $statusCode : 0;
  33964. }
  33965. public function setCode($code)
  33966. {
  33967. if (!\is_callable($code)) {
  33968. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  33969. }
  33970. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  33971. $r = new \ReflectionFunction($code);
  33972. if (null === $r->getClosureThis()) {
  33973. if (\PHP_VERSION_ID < 70000) {
  33974. $code = @\Closure::bind($code, $this);
  33975. } else {
  33976. $code = \Closure::bind($code, $this);
  33977. }
  33978. }
  33979. }
  33980. $this->code = $code;
  33981. return $this;
  33982. }
  33983. public function mergeApplicationDefinition($mergeArgs = true)
  33984. {
  33985. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  33986. return;
  33987. }
  33988. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  33989. $this->applicationDefinitionMerged = true;
  33990. if ($mergeArgs) {
  33991. $currentArguments = $this->definition->getArguments();
  33992. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  33993. $this->definition->addArguments($currentArguments);
  33994. $this->applicationDefinitionMergedWithArgs = true;
  33995. }
  33996. }
  33997. public function setDefinition($definition)
  33998. {
  33999. if ($definition instanceof InputDefinition) {
  34000. $this->definition = $definition;
  34001. } else {
  34002. $this->definition->setDefinition($definition);
  34003. }
  34004. $this->applicationDefinitionMerged = false;
  34005. return $this;
  34006. }
  34007. public function getDefinition()
  34008. {
  34009. return $this->definition;
  34010. }
  34011. public function getNativeDefinition()
  34012. {
  34013. return $this->getDefinition();
  34014. }
  34015. public function addArgument($name, $mode = null, $description = '', $default = null)
  34016. {
  34017. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  34018. return $this;
  34019. }
  34020. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  34021. {
  34022. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  34023. return $this;
  34024. }
  34025. public function setName($name)
  34026. {
  34027. $this->validateName($name);
  34028. $this->name = $name;
  34029. return $this;
  34030. }
  34031. public function setProcessTitle($title)
  34032. {
  34033. $this->processTitle = $title;
  34034. return $this;
  34035. }
  34036. public function getName()
  34037. {
  34038. return $this->name;
  34039. }
  34040. public function setDescription($description)
  34041. {
  34042. $this->description = $description;
  34043. return $this;
  34044. }
  34045. public function getDescription()
  34046. {
  34047. return $this->description;
  34048. }
  34049. public function setHelp($help)
  34050. {
  34051. $this->help = $help;
  34052. return $this;
  34053. }
  34054. public function getHelp()
  34055. {
  34056. return $this->help;
  34057. }
  34058. public function getProcessedHelp()
  34059. {
  34060. $name = $this->name;
  34061. $placeholders = array(
  34062. '%command.name%',
  34063. '%command.full_name%',
  34064. );
  34065. $replacements = array(
  34066. $name,
  34067. $_SERVER['PHP_SELF'].' '.$name,
  34068. );
  34069. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  34070. }
  34071. public function setAliases($aliases)
  34072. {
  34073. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  34074. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  34075. }
  34076. foreach ($aliases as $alias) {
  34077. $this->validateName($alias);
  34078. }
  34079. $this->aliases = $aliases;
  34080. return $this;
  34081. }
  34082. public function getAliases()
  34083. {
  34084. return $this->aliases;
  34085. }
  34086. public function getSynopsis($short = false)
  34087. {
  34088. $key = $short ? 'short' : 'long';
  34089. if (!isset($this->synopsis[$key])) {
  34090. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  34091. }
  34092. return $this->synopsis[$key];
  34093. }
  34094. public function addUsage($usage)
  34095. {
  34096. if (0 !== strpos($usage, $this->name)) {
  34097. $usage = sprintf('%s %s', $this->name, $usage);
  34098. }
  34099. $this->usages[] = $usage;
  34100. return $this;
  34101. }
  34102. public function getUsages()
  34103. {
  34104. return $this->usages;
  34105. }
  34106. public function getHelper($name)
  34107. {
  34108. if (null === $this->helperSet) {
  34109. 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));
  34110. }
  34111. return $this->helperSet->get($name);
  34112. }
  34113. public function asText()
  34114. {
  34115. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34116. $descriptor = new TextDescriptor();
  34117. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  34118. $descriptor->describe($output, $this, array('raw_output' => true));
  34119. return $output->fetch();
  34120. }
  34121. public function asXml($asDom = false)
  34122. {
  34123. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34124. $descriptor = new XmlDescriptor();
  34125. if ($asDom) {
  34126. return $descriptor->getCommandDocument($this);
  34127. }
  34128. $output = new BufferedOutput();
  34129. $descriptor->describe($output, $this);
  34130. return $output->fetch();
  34131. }
  34132. private function validateName($name)
  34133. {
  34134. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  34135. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  34136. }
  34137. }
  34138. }
  34139. <?php
  34140. namespace Symfony\Component\Console\Command;
  34141. use Symfony\Component\Console\Helper\DescriptorHelper;
  34142. use Symfony\Component\Console\Input\InputArgument;
  34143. use Symfony\Component\Console\Input\InputInterface;
  34144. use Symfony\Component\Console\Input\InputOption;
  34145. use Symfony\Component\Console\Output\OutputInterface;
  34146. class HelpCommand extends Command
  34147. {
  34148. private $command;
  34149. protected function configure()
  34150. {
  34151. $this->ignoreValidationErrors();
  34152. $this
  34153. ->setName('help')
  34154. ->setDefinition(array(
  34155. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  34156. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  34157. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34158. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  34159. ))
  34160. ->setDescription('Displays help for a command')
  34161. ->setHelp(<<<'EOF'
  34162. The <info>%command.name%</info> command displays help for a given command:
  34163. <info>php %command.full_name% list</info>
  34164. You can also output the help in other formats by using the <comment>--format</comment> option:
  34165. <info>php %command.full_name% --format=xml list</info>
  34166. To display the list of available commands, please use the <info>list</info> command.
  34167. EOF
  34168. )
  34169. ;
  34170. }
  34171. public function setCommand(Command $command)
  34172. {
  34173. $this->command = $command;
  34174. }
  34175. protected function execute(InputInterface $input, OutputInterface $output)
  34176. {
  34177. if (null === $this->command) {
  34178. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  34179. }
  34180. if ($input->getOption('xml')) {
  34181. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34182. $input->setOption('format', 'xml');
  34183. }
  34184. $helper = new DescriptorHelper();
  34185. $helper->describe($output, $this->command, array(
  34186. 'format' => $input->getOption('format'),
  34187. 'raw_text' => $input->getOption('raw'),
  34188. ));
  34189. $this->command = null;
  34190. }
  34191. }
  34192. <?php
  34193. namespace Symfony\Component\Console\Command;
  34194. use Symfony\Component\Console\Helper\DescriptorHelper;
  34195. use Symfony\Component\Console\Input\InputArgument;
  34196. use Symfony\Component\Console\Input\InputDefinition;
  34197. use Symfony\Component\Console\Input\InputInterface;
  34198. use Symfony\Component\Console\Input\InputOption;
  34199. use Symfony\Component\Console\Output\OutputInterface;
  34200. class ListCommand extends Command
  34201. {
  34202. protected function configure()
  34203. {
  34204. $this
  34205. ->setName('list')
  34206. ->setDefinition($this->createDefinition())
  34207. ->setDescription('Lists commands')
  34208. ->setHelp(<<<'EOF'
  34209. The <info>%command.name%</info> command lists all commands:
  34210. <info>php %command.full_name%</info>
  34211. You can also display the commands for a specific namespace:
  34212. <info>php %command.full_name% test</info>
  34213. You can also output the information in other formats by using the <comment>--format</comment> option:
  34214. <info>php %command.full_name% --format=xml</info>
  34215. It's also possible to get raw list of commands (useful for embedding command runner):
  34216. <info>php %command.full_name% --raw</info>
  34217. EOF
  34218. )
  34219. ;
  34220. }
  34221. public function getNativeDefinition()
  34222. {
  34223. return $this->createDefinition();
  34224. }
  34225. protected function execute(InputInterface $input, OutputInterface $output)
  34226. {
  34227. if ($input->getOption('xml')) {
  34228. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34229. $input->setOption('format', 'xml');
  34230. }
  34231. $helper = new DescriptorHelper();
  34232. $helper->describe($output, $this->getApplication(), array(
  34233. 'format' => $input->getOption('format'),
  34234. 'raw_text' => $input->getOption('raw'),
  34235. 'namespace' => $input->getArgument('namespace'),
  34236. ));
  34237. }
  34238. private function createDefinition()
  34239. {
  34240. return new InputDefinition(array(
  34241. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  34242. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  34243. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  34244. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34245. ));
  34246. }
  34247. }
  34248. <?php
  34249. namespace Symfony\Component\Console;
  34250. final class ConsoleEvents
  34251. {
  34252. const COMMAND = 'console.command';
  34253. const TERMINATE = 'console.terminate';
  34254. const EXCEPTION = 'console.exception';
  34255. }
  34256. <?php
  34257. namespace Symfony\Component\Console\Descriptor;
  34258. use Symfony\Component\Console\Application;
  34259. use Symfony\Component\Console\Command\Command;
  34260. use Symfony\Component\Console\Exception\CommandNotFoundException;
  34261. class ApplicationDescription
  34262. {
  34263. const GLOBAL_NAMESPACE = '_global';
  34264. private $application;
  34265. private $namespace;
  34266. private $namespaces;
  34267. private $commands;
  34268. private $aliases;
  34269. public function __construct(Application $application, $namespace = null)
  34270. {
  34271. $this->application = $application;
  34272. $this->namespace = $namespace;
  34273. }
  34274. public function getNamespaces()
  34275. {
  34276. if (null === $this->namespaces) {
  34277. $this->inspectApplication();
  34278. }
  34279. return $this->namespaces;
  34280. }
  34281. public function getCommands()
  34282. {
  34283. if (null === $this->commands) {
  34284. $this->inspectApplication();
  34285. }
  34286. return $this->commands;
  34287. }
  34288. public function getCommand($name)
  34289. {
  34290. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  34291. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  34292. }
  34293. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  34294. }
  34295. private function inspectApplication()
  34296. {
  34297. $this->commands = array();
  34298. $this->namespaces = array();
  34299. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  34300. foreach ($this->sortCommands($all) as $namespace => $commands) {
  34301. $names = array();
  34302. foreach ($commands as $name => $command) {
  34303. if (!$command->getName()) {
  34304. continue;
  34305. }
  34306. if ($command->getName() === $name) {
  34307. $this->commands[$name] = $command;
  34308. } else {
  34309. $this->aliases[$name] = $command;
  34310. }
  34311. $names[] = $name;
  34312. }
  34313. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  34314. }
  34315. }
  34316. private function sortCommands(array $commands)
  34317. {
  34318. $namespacedCommands = array();
  34319. $globalCommands = array();
  34320. foreach ($commands as $name => $command) {
  34321. $key = $this->application->extractNamespace($name, 1);
  34322. if (!$key) {
  34323. $globalCommands['_global'][$name] = $command;
  34324. } else {
  34325. $namespacedCommands[$key][$name] = $command;
  34326. }
  34327. }
  34328. ksort($namespacedCommands);
  34329. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  34330. foreach ($namespacedCommands as &$commandsSet) {
  34331. ksort($commandsSet);
  34332. }
  34333. unset($commandsSet);
  34334. return $namespacedCommands;
  34335. }
  34336. }
  34337. <?php
  34338. namespace Symfony\Component\Console\Descriptor;
  34339. use Symfony\Component\Console\Application;
  34340. use Symfony\Component\Console\Command\Command;
  34341. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34342. use Symfony\Component\Console\Input\InputArgument;
  34343. use Symfony\Component\Console\Input\InputDefinition;
  34344. use Symfony\Component\Console\Input\InputOption;
  34345. use Symfony\Component\Console\Output\OutputInterface;
  34346. abstract class Descriptor implements DescriptorInterface
  34347. {
  34348. private $output;
  34349. public function describe(OutputInterface $output, $object, array $options = array())
  34350. {
  34351. $this->output = $output;
  34352. switch (true) {
  34353. case $object instanceof InputArgument:
  34354. $this->describeInputArgument($object, $options);
  34355. break;
  34356. case $object instanceof InputOption:
  34357. $this->describeInputOption($object, $options);
  34358. break;
  34359. case $object instanceof InputDefinition:
  34360. $this->describeInputDefinition($object, $options);
  34361. break;
  34362. case $object instanceof Command:
  34363. $this->describeCommand($object, $options);
  34364. break;
  34365. case $object instanceof Application:
  34366. $this->describeApplication($object, $options);
  34367. break;
  34368. default:
  34369. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  34370. }
  34371. }
  34372. protected function write($content, $decorated = false)
  34373. {
  34374. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  34375. }
  34376. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  34377. abstract protected function describeInputOption(InputOption $option, array $options = array());
  34378. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  34379. abstract protected function describeCommand(Command $command, array $options = array());
  34380. abstract protected function describeApplication(Application $application, array $options = array());
  34381. }
  34382. <?php
  34383. namespace Symfony\Component\Console\Descriptor;
  34384. use Symfony\Component\Console\Output\OutputInterface;
  34385. interface DescriptorInterface
  34386. {
  34387. public function describe(OutputInterface $output, $object, array $options = array());
  34388. }
  34389. <?php
  34390. namespace Symfony\Component\Console\Descriptor;
  34391. use Symfony\Component\Console\Application;
  34392. use Symfony\Component\Console\Command\Command;
  34393. use Symfony\Component\Console\Input\InputArgument;
  34394. use Symfony\Component\Console\Input\InputDefinition;
  34395. use Symfony\Component\Console\Input\InputOption;
  34396. class JsonDescriptor extends Descriptor
  34397. {
  34398. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34399. {
  34400. $this->writeData($this->getInputArgumentData($argument), $options);
  34401. }
  34402. protected function describeInputOption(InputOption $option, array $options = array())
  34403. {
  34404. $this->writeData($this->getInputOptionData($option), $options);
  34405. }
  34406. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34407. {
  34408. $this->writeData($this->getInputDefinitionData($definition), $options);
  34409. }
  34410. protected function describeCommand(Command $command, array $options = array())
  34411. {
  34412. $this->writeData($this->getCommandData($command), $options);
  34413. }
  34414. protected function describeApplication(Application $application, array $options = array())
  34415. {
  34416. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34417. $description = new ApplicationDescription($application, $describedNamespace);
  34418. $commands = array();
  34419. foreach ($description->getCommands() as $command) {
  34420. $commands[] = $this->getCommandData($command);
  34421. }
  34422. $data = $describedNamespace
  34423. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  34424. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  34425. $this->writeData($data, $options);
  34426. }
  34427. private function writeData(array $data, array $options)
  34428. {
  34429. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  34430. }
  34431. private function getInputArgumentData(InputArgument $argument)
  34432. {
  34433. return array(
  34434. 'name' => $argument->getName(),
  34435. 'is_required' => $argument->isRequired(),
  34436. 'is_array' => $argument->isArray(),
  34437. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  34438. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  34439. );
  34440. }
  34441. private function getInputOptionData(InputOption $option)
  34442. {
  34443. return array(
  34444. 'name' => '--'.$option->getName(),
  34445. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  34446. 'accept_value' => $option->acceptValue(),
  34447. 'is_value_required' => $option->isValueRequired(),
  34448. 'is_multiple' => $option->isArray(),
  34449. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  34450. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  34451. );
  34452. }
  34453. private function getInputDefinitionData(InputDefinition $definition)
  34454. {
  34455. $inputArguments = array();
  34456. foreach ($definition->getArguments() as $name => $argument) {
  34457. $inputArguments[$name] = $this->getInputArgumentData($argument);
  34458. }
  34459. $inputOptions = array();
  34460. foreach ($definition->getOptions() as $name => $option) {
  34461. $inputOptions[$name] = $this->getInputOptionData($option);
  34462. }
  34463. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  34464. }
  34465. private function getCommandData(Command $command)
  34466. {
  34467. $command->getSynopsis();
  34468. $command->mergeApplicationDefinition(false);
  34469. return array(
  34470. 'name' => $command->getName(),
  34471. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  34472. 'description' => $command->getDescription(),
  34473. 'help' => $command->getProcessedHelp(),
  34474. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  34475. );
  34476. }
  34477. }
  34478. <?php
  34479. namespace Symfony\Component\Console\Descriptor;
  34480. use Symfony\Component\Console\Application;
  34481. use Symfony\Component\Console\Command\Command;
  34482. use Symfony\Component\Console\Helper\Helper;
  34483. use Symfony\Component\Console\Input\InputArgument;
  34484. use Symfony\Component\Console\Input\InputDefinition;
  34485. use Symfony\Component\Console\Input\InputOption;
  34486. class MarkdownDescriptor extends Descriptor
  34487. {
  34488. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34489. {
  34490. $this->write(
  34491. '**'.$argument->getName().':**'."\n\n"
  34492. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  34493. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  34494. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  34495. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  34496. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  34497. );
  34498. }
  34499. protected function describeInputOption(InputOption $option, array $options = array())
  34500. {
  34501. $this->write(
  34502. '**'.$option->getName().':**'."\n\n"
  34503. .'* Name: `--'.$option->getName().'`'."\n"
  34504. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  34505. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  34506. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  34507. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  34508. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  34509. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  34510. );
  34511. }
  34512. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34513. {
  34514. if ($showArguments = \count($definition->getArguments()) > 0) {
  34515. $this->write('### Arguments:');
  34516. foreach ($definition->getArguments() as $argument) {
  34517. $this->write("\n\n");
  34518. $this->write($this->describeInputArgument($argument));
  34519. }
  34520. }
  34521. if (\count($definition->getOptions()) > 0) {
  34522. if ($showArguments) {
  34523. $this->write("\n\n");
  34524. }
  34525. $this->write('### Options:');
  34526. foreach ($definition->getOptions() as $option) {
  34527. $this->write("\n\n");
  34528. $this->write($this->describeInputOption($option));
  34529. }
  34530. }
  34531. }
  34532. protected function describeCommand(Command $command, array $options = array())
  34533. {
  34534. $command->getSynopsis();
  34535. $command->mergeApplicationDefinition(false);
  34536. $this->write(
  34537. $command->getName()."\n"
  34538. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  34539. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  34540. .'* Usage:'."\n\n"
  34541. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  34542. return $carry.' * `'.$usage.'`'."\n";
  34543. })
  34544. );
  34545. if ($help = $command->getProcessedHelp()) {
  34546. $this->write("\n");
  34547. $this->write($help);
  34548. }
  34549. if ($command->getNativeDefinition()) {
  34550. $this->write("\n\n");
  34551. $this->describeInputDefinition($command->getNativeDefinition());
  34552. }
  34553. }
  34554. protected function describeApplication(Application $application, array $options = array())
  34555. {
  34556. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34557. $description = new ApplicationDescription($application, $describedNamespace);
  34558. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  34559. foreach ($description->getNamespaces() as $namespace) {
  34560. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34561. $this->write("\n\n");
  34562. $this->write('**'.$namespace['id'].':**');
  34563. }
  34564. $this->write("\n\n");
  34565. $this->write(implode("\n", array_map(function ($commandName) {
  34566. return '* '.$commandName;
  34567. }, $namespace['commands'])));
  34568. }
  34569. foreach ($description->getCommands() as $command) {
  34570. $this->write("\n\n");
  34571. $this->write($this->describeCommand($command));
  34572. }
  34573. }
  34574. }
  34575. <?php
  34576. namespace Symfony\Component\Console\Descriptor;
  34577. use Symfony\Component\Console\Application;
  34578. use Symfony\Component\Console\Command\Command;
  34579. use Symfony\Component\Console\Formatter\OutputFormatter;
  34580. use Symfony\Component\Console\Helper\Helper;
  34581. use Symfony\Component\Console\Input\InputArgument;
  34582. use Symfony\Component\Console\Input\InputDefinition;
  34583. use Symfony\Component\Console\Input\InputOption;
  34584. class TextDescriptor extends Descriptor
  34585. {
  34586. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34587. {
  34588. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  34589. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  34590. } else {
  34591. $default = '';
  34592. }
  34593. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  34594. $spacingWidth = $totalWidth - \strlen($argument->getName());
  34595. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  34596. $argument->getName(),
  34597. str_repeat(' ', $spacingWidth),
  34598. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  34599. $default
  34600. ), $options);
  34601. }
  34602. protected function describeInputOption(InputOption $option, array $options = array())
  34603. {
  34604. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  34605. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  34606. } else {
  34607. $default = '';
  34608. }
  34609. $value = '';
  34610. if ($option->acceptValue()) {
  34611. $value = '='.strtoupper($option->getName());
  34612. if ($option->isValueOptional()) {
  34613. $value = '['.$value.']';
  34614. }
  34615. }
  34616. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  34617. $synopsis = sprintf('%s%s',
  34618. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  34619. sprintf('--%s%s', $option->getName(), $value)
  34620. );
  34621. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  34622. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  34623. $synopsis,
  34624. str_repeat(' ', $spacingWidth),
  34625. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  34626. $default,
  34627. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  34628. ), $options);
  34629. }
  34630. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34631. {
  34632. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  34633. foreach ($definition->getArguments() as $argument) {
  34634. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  34635. }
  34636. if ($definition->getArguments()) {
  34637. $this->writeText('<comment>Arguments:</comment>', $options);
  34638. $this->writeText("\n");
  34639. foreach ($definition->getArguments() as $argument) {
  34640. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  34641. $this->writeText("\n");
  34642. }
  34643. }
  34644. if ($definition->getArguments() && $definition->getOptions()) {
  34645. $this->writeText("\n");
  34646. }
  34647. if ($definition->getOptions()) {
  34648. $laterOptions = array();
  34649. $this->writeText('<comment>Options:</comment>', $options);
  34650. foreach ($definition->getOptions() as $option) {
  34651. if (\strlen($option->getShortcut()) > 1) {
  34652. $laterOptions[] = $option;
  34653. continue;
  34654. }
  34655. $this->writeText("\n");
  34656. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34657. }
  34658. foreach ($laterOptions as $option) {
  34659. $this->writeText("\n");
  34660. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34661. }
  34662. }
  34663. }
  34664. protected function describeCommand(Command $command, array $options = array())
  34665. {
  34666. $command->getSynopsis(true);
  34667. $command->getSynopsis(false);
  34668. $command->mergeApplicationDefinition(false);
  34669. $this->writeText('<comment>Usage:</comment>', $options);
  34670. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  34671. $this->writeText("\n");
  34672. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  34673. }
  34674. $this->writeText("\n");
  34675. $definition = $command->getNativeDefinition();
  34676. if ($definition->getOptions() || $definition->getArguments()) {
  34677. $this->writeText("\n");
  34678. $this->describeInputDefinition($definition, $options);
  34679. $this->writeText("\n");
  34680. }
  34681. if ($help = $command->getProcessedHelp()) {
  34682. $this->writeText("\n");
  34683. $this->writeText('<comment>Help:</comment>', $options);
  34684. $this->writeText("\n");
  34685. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  34686. $this->writeText("\n");
  34687. }
  34688. }
  34689. protected function describeApplication(Application $application, array $options = array())
  34690. {
  34691. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34692. $description = new ApplicationDescription($application, $describedNamespace);
  34693. if (isset($options['raw_text']) && $options['raw_text']) {
  34694. $width = $this->getColumnWidth($description->getCommands());
  34695. foreach ($description->getCommands() as $command) {
  34696. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  34697. $this->writeText("\n");
  34698. }
  34699. } else {
  34700. if ('' != $help = $application->getHelp()) {
  34701. $this->writeText("$help\n\n", $options);
  34702. }
  34703. $this->writeText("<comment>Usage:</comment>\n", $options);
  34704. $this->writeText(" command [options] [arguments]\n\n", $options);
  34705. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  34706. $this->writeText("\n");
  34707. $this->writeText("\n");
  34708. $width = $this->getColumnWidth($description->getCommands());
  34709. if ($describedNamespace) {
  34710. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  34711. } else {
  34712. $this->writeText('<comment>Available commands:</comment>', $options);
  34713. }
  34714. foreach ($description->getNamespaces() as $namespace) {
  34715. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34716. $this->writeText("\n");
  34717. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  34718. }
  34719. foreach ($namespace['commands'] as $name) {
  34720. $this->writeText("\n");
  34721. $spacingWidth = $width - Helper::strlen($name);
  34722. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  34723. }
  34724. }
  34725. $this->writeText("\n");
  34726. }
  34727. }
  34728. private function writeText($content, array $options = array())
  34729. {
  34730. $this->write(
  34731. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  34732. isset($options['raw_output']) ? !$options['raw_output'] : true
  34733. );
  34734. }
  34735. private function formatDefaultValue($default)
  34736. {
  34737. if (INF === $default) {
  34738. return 'INF';
  34739. }
  34740. if (\is_string($default)) {
  34741. $default = OutputFormatter::escape($default);
  34742. } elseif (\is_array($default)) {
  34743. foreach ($default as $key => $value) {
  34744. if (\is_string($value)) {
  34745. $default[$key] = OutputFormatter::escape($value);
  34746. }
  34747. }
  34748. }
  34749. if (\PHP_VERSION_ID < 50400) {
  34750. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  34751. }
  34752. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  34753. }
  34754. private function getColumnWidth(array $commands)
  34755. {
  34756. $widths = array();
  34757. foreach ($commands as $command) {
  34758. $widths[] = Helper::strlen($command->getName());
  34759. foreach ($command->getAliases() as $alias) {
  34760. $widths[] = Helper::strlen($alias);
  34761. }
  34762. }
  34763. return max($widths) + 2;
  34764. }
  34765. private function calculateTotalWidthForOptions(array $options)
  34766. {
  34767. $totalWidth = 0;
  34768. foreach ($options as $option) {
  34769. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  34770. if ($option->acceptValue()) {
  34771. $valueLength = 1 + Helper::strlen($option->getName());
  34772. $valueLength += $option->isValueOptional() ? 2 : 0;
  34773. $nameLength += $valueLength;
  34774. }
  34775. $totalWidth = max($totalWidth, $nameLength);
  34776. }
  34777. return $totalWidth;
  34778. }
  34779. }
  34780. <?php
  34781. namespace Symfony\Component\Console\Descriptor;
  34782. use Symfony\Component\Console\Application;
  34783. use Symfony\Component\Console\Command\Command;
  34784. use Symfony\Component\Console\Input\InputArgument;
  34785. use Symfony\Component\Console\Input\InputDefinition;
  34786. use Symfony\Component\Console\Input\InputOption;
  34787. class XmlDescriptor extends Descriptor
  34788. {
  34789. public function getInputDefinitionDocument(InputDefinition $definition)
  34790. {
  34791. $dom = new \DOMDocument('1.0', 'UTF-8');
  34792. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  34793. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  34794. foreach ($definition->getArguments() as $argument) {
  34795. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  34796. }
  34797. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  34798. foreach ($definition->getOptions() as $option) {
  34799. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  34800. }
  34801. return $dom;
  34802. }
  34803. public function getCommandDocument(Command $command)
  34804. {
  34805. $dom = new \DOMDocument('1.0', 'UTF-8');
  34806. $dom->appendChild($commandXML = $dom->createElement('command'));
  34807. $command->getSynopsis();
  34808. $command->mergeApplicationDefinition(false);
  34809. $commandXML->setAttribute('id', $command->getName());
  34810. $commandXML->setAttribute('name', $command->getName());
  34811. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  34812. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  34813. $usagesXML->appendChild($dom->createElement('usage', $usage));
  34814. }
  34815. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  34816. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  34817. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  34818. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  34819. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  34820. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  34821. return $dom;
  34822. }
  34823. public function getApplicationDocument(Application $application, $namespace = null)
  34824. {
  34825. $dom = new \DOMDocument('1.0', 'UTF-8');
  34826. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  34827. if ('UNKNOWN' !== $application->getName()) {
  34828. $rootXml->setAttribute('name', $application->getName());
  34829. if ('UNKNOWN' !== $application->getVersion()) {
  34830. $rootXml->setAttribute('version', $application->getVersion());
  34831. }
  34832. }
  34833. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  34834. $description = new ApplicationDescription($application, $namespace);
  34835. if ($namespace) {
  34836. $commandsXML->setAttribute('namespace', $namespace);
  34837. }
  34838. foreach ($description->getCommands() as $command) {
  34839. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  34840. }
  34841. if (!$namespace) {
  34842. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  34843. foreach ($description->getNamespaces() as $namespaceDescription) {
  34844. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  34845. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  34846. foreach ($namespaceDescription['commands'] as $name) {
  34847. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  34848. $commandXML->appendChild($dom->createTextNode($name));
  34849. }
  34850. }
  34851. }
  34852. return $dom;
  34853. }
  34854. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34855. {
  34856. $this->writeDocument($this->getInputArgumentDocument($argument));
  34857. }
  34858. protected function describeInputOption(InputOption $option, array $options = array())
  34859. {
  34860. $this->writeDocument($this->getInputOptionDocument($option));
  34861. }
  34862. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34863. {
  34864. $this->writeDocument($this->getInputDefinitionDocument($definition));
  34865. }
  34866. protected function describeCommand(Command $command, array $options = array())
  34867. {
  34868. $this->writeDocument($this->getCommandDocument($command));
  34869. }
  34870. protected function describeApplication(Application $application, array $options = array())
  34871. {
  34872. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  34873. }
  34874. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  34875. {
  34876. foreach ($importedParent->childNodes as $childNode) {
  34877. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  34878. }
  34879. }
  34880. private function writeDocument(\DOMDocument $dom)
  34881. {
  34882. $dom->formatOutput = true;
  34883. $this->write($dom->saveXML());
  34884. }
  34885. private function getInputArgumentDocument(InputArgument $argument)
  34886. {
  34887. $dom = new \DOMDocument('1.0', 'UTF-8');
  34888. $dom->appendChild($objectXML = $dom->createElement('argument'));
  34889. $objectXML->setAttribute('name', $argument->getName());
  34890. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  34891. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  34892. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34893. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  34894. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34895. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  34896. foreach ($defaults as $default) {
  34897. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34898. $defaultXML->appendChild($dom->createTextNode($default));
  34899. }
  34900. return $dom;
  34901. }
  34902. private function getInputOptionDocument(InputOption $option)
  34903. {
  34904. $dom = new \DOMDocument('1.0', 'UTF-8');
  34905. $dom->appendChild($objectXML = $dom->createElement('option'));
  34906. $objectXML->setAttribute('name', '--'.$option->getName());
  34907. $pos = strpos($option->getShortcut(), '|');
  34908. if (false !== $pos) {
  34909. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  34910. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  34911. } else {
  34912. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  34913. }
  34914. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  34915. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  34916. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  34917. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34918. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  34919. if ($option->acceptValue()) {
  34920. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  34921. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34922. if (!empty($defaults)) {
  34923. foreach ($defaults as $default) {
  34924. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34925. $defaultXML->appendChild($dom->createTextNode($default));
  34926. }
  34927. }
  34928. }
  34929. return $dom;
  34930. }
  34931. }
  34932. <?php
  34933. namespace Symfony\Component\Console\Event;
  34934. class ConsoleCommandEvent extends ConsoleEvent
  34935. {
  34936. const RETURN_CODE_DISABLED = 113;
  34937. private $commandShouldRun = true;
  34938. public function disableCommand()
  34939. {
  34940. return $this->commandShouldRun = false;
  34941. }
  34942. public function enableCommand()
  34943. {
  34944. return $this->commandShouldRun = true;
  34945. }
  34946. public function commandShouldRun()
  34947. {
  34948. return $this->commandShouldRun;
  34949. }
  34950. }
  34951. <?php
  34952. namespace Symfony\Component\Console\Event;
  34953. use Symfony\Component\Console\Command\Command;
  34954. use Symfony\Component\Console\Input\InputInterface;
  34955. use Symfony\Component\Console\Output\OutputInterface;
  34956. use Symfony\Component\EventDispatcher\Event;
  34957. class ConsoleEvent extends Event
  34958. {
  34959. protected $command;
  34960. private $input;
  34961. private $output;
  34962. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  34963. {
  34964. $this->command = $command;
  34965. $this->input = $input;
  34966. $this->output = $output;
  34967. }
  34968. public function getCommand()
  34969. {
  34970. return $this->command;
  34971. }
  34972. public function getInput()
  34973. {
  34974. return $this->input;
  34975. }
  34976. public function getOutput()
  34977. {
  34978. return $this->output;
  34979. }
  34980. }
  34981. <?php
  34982. namespace Symfony\Component\Console\Event;
  34983. use Symfony\Component\Console\Command\Command;
  34984. use Symfony\Component\Console\Input\InputInterface;
  34985. use Symfony\Component\Console\Output\OutputInterface;
  34986. class ConsoleExceptionEvent extends ConsoleEvent
  34987. {
  34988. private $exception;
  34989. private $exitCode;
  34990. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  34991. {
  34992. parent::__construct($command, $input, $output);
  34993. $this->setException($exception);
  34994. $this->exitCode = (int) $exitCode;
  34995. }
  34996. public function getException()
  34997. {
  34998. return $this->exception;
  34999. }
  35000. public function setException(\Exception $exception)
  35001. {
  35002. $this->exception = $exception;
  35003. }
  35004. public function getExitCode()
  35005. {
  35006. return $this->exitCode;
  35007. }
  35008. }
  35009. <?php
  35010. namespace Symfony\Component\Console\Event;
  35011. use Symfony\Component\Console\Command\Command;
  35012. use Symfony\Component\Console\Input\InputInterface;
  35013. use Symfony\Component\Console\Output\OutputInterface;
  35014. class ConsoleTerminateEvent extends ConsoleEvent
  35015. {
  35016. private $exitCode;
  35017. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  35018. {
  35019. parent::__construct($command, $input, $output);
  35020. $this->setExitCode($exitCode);
  35021. }
  35022. public function setExitCode($exitCode)
  35023. {
  35024. $this->exitCode = (int) $exitCode;
  35025. }
  35026. public function getExitCode()
  35027. {
  35028. return $this->exitCode;
  35029. }
  35030. }
  35031. <?php
  35032. namespace Symfony\Component\Console\Exception;
  35033. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  35034. {
  35035. private $alternatives;
  35036. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  35037. {
  35038. parent::__construct($message, $code, $previous);
  35039. $this->alternatives = $alternatives;
  35040. }
  35041. public function getAlternatives()
  35042. {
  35043. return $this->alternatives;
  35044. }
  35045. }
  35046. <?php
  35047. namespace Symfony\Component\Console\Exception;
  35048. interface ExceptionInterface
  35049. {
  35050. }
  35051. <?php
  35052. namespace Symfony\Component\Console\Exception;
  35053. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  35054. {
  35055. }
  35056. <?php
  35057. namespace Symfony\Component\Console\Exception;
  35058. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  35059. {
  35060. }
  35061. <?php
  35062. namespace Symfony\Component\Console\Exception;
  35063. class LogicException extends \LogicException implements ExceptionInterface
  35064. {
  35065. }
  35066. <?php
  35067. namespace Symfony\Component\Console\Exception;
  35068. class RuntimeException extends \RuntimeException implements ExceptionInterface
  35069. {
  35070. }
  35071. <?php
  35072. namespace Symfony\Component\Console\Formatter;
  35073. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35074. class OutputFormatter implements OutputFormatterInterface
  35075. {
  35076. private $decorated;
  35077. private $styles = array();
  35078. private $styleStack;
  35079. public static function escape($text)
  35080. {
  35081. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  35082. return self::escapeTrailingBackslash($text);
  35083. }
  35084. public static function escapeTrailingBackslash($text)
  35085. {
  35086. if ('\\' === substr($text, -1)) {
  35087. $len = \strlen($text);
  35088. $text = rtrim($text, '\\');
  35089. $text = str_replace("\0", '', $text);
  35090. $text .= str_repeat("\0", $len - \strlen($text));
  35091. }
  35092. return $text;
  35093. }
  35094. public function __construct($decorated = false, array $styles = array())
  35095. {
  35096. $this->decorated = (bool) $decorated;
  35097. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  35098. $this->setStyle('info', new OutputFormatterStyle('green'));
  35099. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  35100. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  35101. foreach ($styles as $name => $style) {
  35102. $this->setStyle($name, $style);
  35103. }
  35104. $this->styleStack = new OutputFormatterStyleStack();
  35105. }
  35106. public function setDecorated($decorated)
  35107. {
  35108. $this->decorated = (bool) $decorated;
  35109. }
  35110. public function isDecorated()
  35111. {
  35112. return $this->decorated;
  35113. }
  35114. public function setStyle($name, OutputFormatterStyleInterface $style)
  35115. {
  35116. $this->styles[strtolower($name)] = $style;
  35117. }
  35118. public function hasStyle($name)
  35119. {
  35120. return isset($this->styles[strtolower($name)]);
  35121. }
  35122. public function getStyle($name)
  35123. {
  35124. if (!$this->hasStyle($name)) {
  35125. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  35126. }
  35127. return $this->styles[strtolower($name)];
  35128. }
  35129. public function format($message)
  35130. {
  35131. $message = (string) $message;
  35132. $offset = 0;
  35133. $output = '';
  35134. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  35135. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  35136. foreach ($matches[0] as $i => $match) {
  35137. $pos = $match[1];
  35138. $text = $match[0];
  35139. if (0 != $pos && '\\' == $message[$pos - 1]) {
  35140. continue;
  35141. }
  35142. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  35143. $offset = $pos + \strlen($text);
  35144. if ($open = '/' != $text[1]) {
  35145. $tag = $matches[1][$i][0];
  35146. } else {
  35147. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  35148. }
  35149. if (!$open && !$tag) {
  35150. $this->styleStack->pop();
  35151. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  35152. $output .= $this->applyCurrentStyle($text);
  35153. } elseif ($open) {
  35154. $this->styleStack->push($style);
  35155. } else {
  35156. $this->styleStack->pop($style);
  35157. }
  35158. }
  35159. $output .= $this->applyCurrentStyle(substr($message, $offset));
  35160. if (false !== strpos($output, "\0")) {
  35161. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  35162. }
  35163. return str_replace('\\<', '<', $output);
  35164. }
  35165. public function getStyleStack()
  35166. {
  35167. return $this->styleStack;
  35168. }
  35169. private function createStyleFromString($string)
  35170. {
  35171. if (isset($this->styles[$string])) {
  35172. return $this->styles[$string];
  35173. }
  35174. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  35175. return false;
  35176. }
  35177. $style = new OutputFormatterStyle();
  35178. foreach ($matches as $match) {
  35179. array_shift($match);
  35180. if ('fg' == $match[0]) {
  35181. $style->setForeground($match[1]);
  35182. } elseif ('bg' == $match[0]) {
  35183. $style->setBackground($match[1]);
  35184. } else {
  35185. try {
  35186. $style->setOption($match[1]);
  35187. } catch (\InvalidArgumentException $e) {
  35188. return false;
  35189. }
  35190. }
  35191. }
  35192. return $style;
  35193. }
  35194. private function applyCurrentStyle($text)
  35195. {
  35196. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  35197. }
  35198. }
  35199. <?php
  35200. namespace Symfony\Component\Console\Formatter;
  35201. interface OutputFormatterInterface
  35202. {
  35203. public function setDecorated($decorated);
  35204. public function isDecorated();
  35205. public function setStyle($name, OutputFormatterStyleInterface $style);
  35206. public function hasStyle($name);
  35207. public function getStyle($name);
  35208. public function format($message);
  35209. }
  35210. <?php
  35211. namespace Symfony\Component\Console\Formatter;
  35212. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35213. class OutputFormatterStyle implements OutputFormatterStyleInterface
  35214. {
  35215. private static $availableForegroundColors = array(
  35216. 'black' => array('set' => 30, 'unset' => 39),
  35217. 'red' => array('set' => 31, 'unset' => 39),
  35218. 'green' => array('set' => 32, 'unset' => 39),
  35219. 'yellow' => array('set' => 33, 'unset' => 39),
  35220. 'blue' => array('set' => 34, 'unset' => 39),
  35221. 'magenta' => array('set' => 35, 'unset' => 39),
  35222. 'cyan' => array('set' => 36, 'unset' => 39),
  35223. 'white' => array('set' => 37, 'unset' => 39),
  35224. 'default' => array('set' => 39, 'unset' => 39),
  35225. );
  35226. private static $availableBackgroundColors = array(
  35227. 'black' => array('set' => 40, 'unset' => 49),
  35228. 'red' => array('set' => 41, 'unset' => 49),
  35229. 'green' => array('set' => 42, 'unset' => 49),
  35230. 'yellow' => array('set' => 43, 'unset' => 49),
  35231. 'blue' => array('set' => 44, 'unset' => 49),
  35232. 'magenta' => array('set' => 45, 'unset' => 49),
  35233. 'cyan' => array('set' => 46, 'unset' => 49),
  35234. 'white' => array('set' => 47, 'unset' => 49),
  35235. 'default' => array('set' => 49, 'unset' => 49),
  35236. );
  35237. private static $availableOptions = array(
  35238. 'bold' => array('set' => 1, 'unset' => 22),
  35239. 'underscore' => array('set' => 4, 'unset' => 24),
  35240. 'blink' => array('set' => 5, 'unset' => 25),
  35241. 'reverse' => array('set' => 7, 'unset' => 27),
  35242. 'conceal' => array('set' => 8, 'unset' => 28),
  35243. );
  35244. private $foreground;
  35245. private $background;
  35246. private $options = array();
  35247. public function __construct($foreground = null, $background = null, array $options = array())
  35248. {
  35249. if (null !== $foreground) {
  35250. $this->setForeground($foreground);
  35251. }
  35252. if (null !== $background) {
  35253. $this->setBackground($background);
  35254. }
  35255. if (\count($options)) {
  35256. $this->setOptions($options);
  35257. }
  35258. }
  35259. public function setForeground($color = null)
  35260. {
  35261. if (null === $color) {
  35262. $this->foreground = null;
  35263. return;
  35264. }
  35265. if (!isset(static::$availableForegroundColors[$color])) {
  35266. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  35267. }
  35268. $this->foreground = static::$availableForegroundColors[$color];
  35269. }
  35270. public function setBackground($color = null)
  35271. {
  35272. if (null === $color) {
  35273. $this->background = null;
  35274. return;
  35275. }
  35276. if (!isset(static::$availableBackgroundColors[$color])) {
  35277. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  35278. }
  35279. $this->background = static::$availableBackgroundColors[$color];
  35280. }
  35281. public function setOption($option)
  35282. {
  35283. if (!isset(static::$availableOptions[$option])) {
  35284. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35285. }
  35286. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  35287. $this->options[] = static::$availableOptions[$option];
  35288. }
  35289. }
  35290. public function unsetOption($option)
  35291. {
  35292. if (!isset(static::$availableOptions[$option])) {
  35293. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35294. }
  35295. $pos = array_search(static::$availableOptions[$option], $this->options);
  35296. if (false !== $pos) {
  35297. unset($this->options[$pos]);
  35298. }
  35299. }
  35300. public function setOptions(array $options)
  35301. {
  35302. $this->options = array();
  35303. foreach ($options as $option) {
  35304. $this->setOption($option);
  35305. }
  35306. }
  35307. public function apply($text)
  35308. {
  35309. $setCodes = array();
  35310. $unsetCodes = array();
  35311. if (null !== $this->foreground) {
  35312. $setCodes[] = $this->foreground['set'];
  35313. $unsetCodes[] = $this->foreground['unset'];
  35314. }
  35315. if (null !== $this->background) {
  35316. $setCodes[] = $this->background['set'];
  35317. $unsetCodes[] = $this->background['unset'];
  35318. }
  35319. if (\count($this->options)) {
  35320. foreach ($this->options as $option) {
  35321. $setCodes[] = $option['set'];
  35322. $unsetCodes[] = $option['unset'];
  35323. }
  35324. }
  35325. if (0 === \count($setCodes)) {
  35326. return $text;
  35327. }
  35328. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  35329. }
  35330. }
  35331. <?php
  35332. namespace Symfony\Component\Console\Formatter;
  35333. interface OutputFormatterStyleInterface
  35334. {
  35335. public function setForeground($color = null);
  35336. public function setBackground($color = null);
  35337. public function setOption($option);
  35338. public function unsetOption($option);
  35339. public function setOptions(array $options);
  35340. public function apply($text);
  35341. }
  35342. <?php
  35343. namespace Symfony\Component\Console\Formatter;
  35344. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35345. class OutputFormatterStyleStack
  35346. {
  35347. private $styles;
  35348. private $emptyStyle;
  35349. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  35350. {
  35351. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  35352. $this->reset();
  35353. }
  35354. public function reset()
  35355. {
  35356. $this->styles = array();
  35357. }
  35358. public function push(OutputFormatterStyleInterface $style)
  35359. {
  35360. $this->styles[] = $style;
  35361. }
  35362. public function pop(OutputFormatterStyleInterface $style = null)
  35363. {
  35364. if (empty($this->styles)) {
  35365. return $this->emptyStyle;
  35366. }
  35367. if (null === $style) {
  35368. return array_pop($this->styles);
  35369. }
  35370. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  35371. if ($style->apply('') === $stackedStyle->apply('')) {
  35372. $this->styles = \array_slice($this->styles, 0, $index);
  35373. return $stackedStyle;
  35374. }
  35375. }
  35376. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  35377. }
  35378. public function getCurrent()
  35379. {
  35380. if (empty($this->styles)) {
  35381. return $this->emptyStyle;
  35382. }
  35383. return $this->styles[\count($this->styles) - 1];
  35384. }
  35385. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  35386. {
  35387. $this->emptyStyle = $emptyStyle;
  35388. return $this;
  35389. }
  35390. public function getEmptyStyle()
  35391. {
  35392. return $this->emptyStyle;
  35393. }
  35394. }
  35395. <?php
  35396. namespace Symfony\Component\Console\Helper;
  35397. class DebugFormatterHelper extends Helper
  35398. {
  35399. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  35400. private $started = array();
  35401. private $count = -1;
  35402. public function start($id, $message, $prefix = 'RUN')
  35403. {
  35404. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  35405. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  35406. }
  35407. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  35408. {
  35409. $message = '';
  35410. if ($error) {
  35411. if (isset($this->started[$id]['out'])) {
  35412. $message .= "\n";
  35413. unset($this->started[$id]['out']);
  35414. }
  35415. if (!isset($this->started[$id]['err'])) {
  35416. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  35417. $this->started[$id]['err'] = true;
  35418. }
  35419. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  35420. } else {
  35421. if (isset($this->started[$id]['err'])) {
  35422. $message .= "\n";
  35423. unset($this->started[$id]['err']);
  35424. }
  35425. if (!isset($this->started[$id]['out'])) {
  35426. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  35427. $this->started[$id]['out'] = true;
  35428. }
  35429. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  35430. }
  35431. return $message;
  35432. }
  35433. public function stop($id, $message, $successful, $prefix = 'RES')
  35434. {
  35435. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  35436. if ($successful) {
  35437. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35438. }
  35439. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35440. unset($this->started[$id]['out'], $this->started[$id]['err']);
  35441. return $message;
  35442. }
  35443. private function getBorder($id)
  35444. {
  35445. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  35446. }
  35447. public function getName()
  35448. {
  35449. return 'debug_formatter';
  35450. }
  35451. }
  35452. <?php
  35453. namespace Symfony\Component\Console\Helper;
  35454. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  35455. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  35456. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  35457. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35458. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35459. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35460. use Symfony\Component\Console\Output\OutputInterface;
  35461. class DescriptorHelper extends Helper
  35462. {
  35463. private $descriptors = array();
  35464. public function __construct()
  35465. {
  35466. $this
  35467. ->register('txt', new TextDescriptor())
  35468. ->register('xml', new XmlDescriptor())
  35469. ->register('json', new JsonDescriptor())
  35470. ->register('md', new MarkdownDescriptor())
  35471. ;
  35472. }
  35473. public function describe(OutputInterface $output, $object, array $options = array())
  35474. {
  35475. $options = array_merge(array(
  35476. 'raw_text' => false,
  35477. 'format' => 'txt',
  35478. ), $options);
  35479. if (!isset($this->descriptors[$options['format']])) {
  35480. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  35481. }
  35482. $descriptor = $this->descriptors[$options['format']];
  35483. $descriptor->describe($output, $object, $options);
  35484. }
  35485. public function register($format, DescriptorInterface $descriptor)
  35486. {
  35487. $this->descriptors[$format] = $descriptor;
  35488. return $this;
  35489. }
  35490. public function getName()
  35491. {
  35492. return 'descriptor';
  35493. }
  35494. }
  35495. <?php
  35496. namespace Symfony\Component\Console\Helper;
  35497. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35498. use Symfony\Component\Console\Exception\RuntimeException;
  35499. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35500. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35501. use Symfony\Component\Console\Output\OutputInterface;
  35502. class DialogHelper extends InputAwareHelper
  35503. {
  35504. private $inputStream;
  35505. private static $shell;
  35506. private static $stty;
  35507. public function __construct($triggerDeprecationError = true)
  35508. {
  35509. if ($triggerDeprecationError) {
  35510. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35511. }
  35512. }
  35513. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  35514. {
  35515. if ($output instanceof ConsoleOutputInterface) {
  35516. $output = $output->getErrorOutput();
  35517. }
  35518. $width = max(array_map('strlen', array_keys($choices)));
  35519. $messages = (array) $question;
  35520. foreach ($choices as $key => $value) {
  35521. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  35522. }
  35523. $output->writeln($messages);
  35524. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  35525. $selectedChoices = str_replace(' ', '', $picked);
  35526. if ($multiselect) {
  35527. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  35528. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  35529. }
  35530. $selectedChoices = explode(',', $selectedChoices);
  35531. } else {
  35532. $selectedChoices = array($picked);
  35533. }
  35534. $multiselectChoices = array();
  35535. foreach ($selectedChoices as $value) {
  35536. if (empty($choices[$value])) {
  35537. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  35538. }
  35539. $multiselectChoices[] = $value;
  35540. }
  35541. if ($multiselect) {
  35542. return $multiselectChoices;
  35543. }
  35544. return $picked;
  35545. }, $attempts, $default);
  35546. return $result;
  35547. }
  35548. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  35549. {
  35550. if ($this->input && !$this->input->isInteractive()) {
  35551. return $default;
  35552. }
  35553. if ($output instanceof ConsoleOutputInterface) {
  35554. $output = $output->getErrorOutput();
  35555. }
  35556. $output->write($question);
  35557. $inputStream = $this->inputStream ?: STDIN;
  35558. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35559. $ret = fgets($inputStream, 4096);
  35560. if (false === $ret) {
  35561. throw new RuntimeException('Aborted');
  35562. }
  35563. $ret = trim($ret);
  35564. } else {
  35565. $ret = '';
  35566. $i = 0;
  35567. $ofs = -1;
  35568. $matches = $autocomplete;
  35569. $numMatches = \count($matches);
  35570. $sttyMode = shell_exec('stty -g');
  35571. shell_exec('stty -icanon -echo');
  35572. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35573. while (!feof($inputStream)) {
  35574. $c = fread($inputStream, 1);
  35575. if ("\177" === $c) {
  35576. if (0 === $numMatches && 0 !== $i) {
  35577. --$i;
  35578. $output->write("\033[1D");
  35579. }
  35580. if (0 === $i) {
  35581. $ofs = -1;
  35582. $matches = $autocomplete;
  35583. $numMatches = \count($matches);
  35584. } else {
  35585. $numMatches = 0;
  35586. }
  35587. $ret = substr($ret, 0, $i);
  35588. } elseif ("\033" === $c) {
  35589. $c .= fread($inputStream, 2);
  35590. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35591. if ('A' === $c[2] && -1 === $ofs) {
  35592. $ofs = 0;
  35593. }
  35594. if (0 === $numMatches) {
  35595. continue;
  35596. }
  35597. $ofs += ('A' === $c[2]) ? -1 : 1;
  35598. $ofs = ($numMatches + $ofs) % $numMatches;
  35599. }
  35600. } elseif (\ord($c) < 32) {
  35601. if ("\t" === $c || "\n" === $c) {
  35602. if ($numMatches > 0 && -1 !== $ofs) {
  35603. $ret = $matches[$ofs];
  35604. $output->write(substr($ret, $i));
  35605. $i = \strlen($ret);
  35606. }
  35607. if ("\n" === $c) {
  35608. $output->write($c);
  35609. break;
  35610. }
  35611. $numMatches = 0;
  35612. }
  35613. continue;
  35614. } else {
  35615. $output->write($c);
  35616. $ret .= $c;
  35617. ++$i;
  35618. $numMatches = 0;
  35619. $ofs = 0;
  35620. foreach ($autocomplete as $value) {
  35621. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  35622. $matches[$numMatches++] = $value;
  35623. }
  35624. }
  35625. }
  35626. $output->write("\033[K");
  35627. if ($numMatches > 0 && -1 !== $ofs) {
  35628. $output->write("\0337");
  35629. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  35630. $output->write("\0338");
  35631. }
  35632. }
  35633. shell_exec(sprintf('stty %s', $sttyMode));
  35634. }
  35635. return \strlen($ret) > 0 ? $ret : $default;
  35636. }
  35637. public function askConfirmation(OutputInterface $output, $question, $default = true)
  35638. {
  35639. $answer = 'z';
  35640. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  35641. $answer = $this->ask($output, $question);
  35642. }
  35643. if (false === $default) {
  35644. return $answer && 'y' == strtolower($answer[0]);
  35645. }
  35646. return !$answer || 'y' == strtolower($answer[0]);
  35647. }
  35648. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  35649. {
  35650. if ($output instanceof ConsoleOutputInterface) {
  35651. $output = $output->getErrorOutput();
  35652. }
  35653. if ('\\' === \DIRECTORY_SEPARATOR) {
  35654. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35655. if ('phar:' === substr(__FILE__, 0, 5)) {
  35656. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35657. copy($exe, $tmpExe);
  35658. $exe = $tmpExe;
  35659. }
  35660. $output->write($question);
  35661. $value = rtrim(shell_exec($exe));
  35662. $output->writeln('');
  35663. if (isset($tmpExe)) {
  35664. unlink($tmpExe);
  35665. }
  35666. return $value;
  35667. }
  35668. if ($this->hasSttyAvailable()) {
  35669. $output->write($question);
  35670. $sttyMode = shell_exec('stty -g');
  35671. shell_exec('stty -echo');
  35672. $value = fgets($this->inputStream ?: STDIN, 4096);
  35673. shell_exec(sprintf('stty %s', $sttyMode));
  35674. if (false === $value) {
  35675. throw new RuntimeException('Aborted');
  35676. }
  35677. $value = trim($value);
  35678. $output->writeln('');
  35679. return $value;
  35680. }
  35681. if (false !== $shell = $this->getShell()) {
  35682. $output->write($question);
  35683. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35684. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35685. $value = rtrim(shell_exec($command));
  35686. $output->writeln('');
  35687. return $value;
  35688. }
  35689. if ($fallback) {
  35690. return $this->ask($output, $question);
  35691. }
  35692. throw new RuntimeException('Unable to hide the response');
  35693. }
  35694. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  35695. {
  35696. $that = $this;
  35697. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  35698. return $that->ask($output, $question, $default, $autocomplete);
  35699. };
  35700. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35701. }
  35702. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  35703. {
  35704. $that = $this;
  35705. $interviewer = function () use ($output, $question, $fallback, $that) {
  35706. return $that->askHiddenResponse($output, $question, $fallback);
  35707. };
  35708. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35709. }
  35710. public function setInputStream($stream)
  35711. {
  35712. $this->inputStream = $stream;
  35713. }
  35714. public function getInputStream()
  35715. {
  35716. return $this->inputStream;
  35717. }
  35718. public function getName()
  35719. {
  35720. return 'dialog';
  35721. }
  35722. private function getShell()
  35723. {
  35724. if (null !== self::$shell) {
  35725. return self::$shell;
  35726. }
  35727. self::$shell = false;
  35728. if (file_exists('/usr/bin/env')) {
  35729. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35730. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35731. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35732. self::$shell = $sh;
  35733. break;
  35734. }
  35735. }
  35736. }
  35737. return self::$shell;
  35738. }
  35739. private function hasSttyAvailable()
  35740. {
  35741. if (null !== self::$stty) {
  35742. return self::$stty;
  35743. }
  35744. exec('stty 2>&1', $output, $exitcode);
  35745. return self::$stty = 0 === $exitcode;
  35746. }
  35747. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  35748. {
  35749. if ($output instanceof ConsoleOutputInterface) {
  35750. $output = $output->getErrorOutput();
  35751. }
  35752. $e = null;
  35753. while (false === $attempts || $attempts--) {
  35754. if (null !== $e) {
  35755. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  35756. }
  35757. try {
  35758. return \call_user_func($validator, $interviewer());
  35759. } catch (\Exception $e) {
  35760. }
  35761. }
  35762. throw $e;
  35763. }
  35764. }
  35765. <?php
  35766. namespace Symfony\Component\Console\Helper;
  35767. use Symfony\Component\Console\Formatter\OutputFormatter;
  35768. class FormatterHelper extends Helper
  35769. {
  35770. public function formatSection($section, $message, $style = 'info')
  35771. {
  35772. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  35773. }
  35774. public function formatBlock($messages, $style, $large = false)
  35775. {
  35776. if (!\is_array($messages)) {
  35777. $messages = array($messages);
  35778. }
  35779. $len = 0;
  35780. $lines = array();
  35781. foreach ($messages as $message) {
  35782. $message = OutputFormatter::escape($message);
  35783. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  35784. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  35785. }
  35786. $messages = $large ? array(str_repeat(' ', $len)) : array();
  35787. for ($i = 0; isset($lines[$i]); ++$i) {
  35788. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  35789. }
  35790. if ($large) {
  35791. $messages[] = str_repeat(' ', $len);
  35792. }
  35793. for ($i = 0; isset($messages[$i]); ++$i) {
  35794. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  35795. }
  35796. return implode("\n", $messages);
  35797. }
  35798. public function getName()
  35799. {
  35800. return 'formatter';
  35801. }
  35802. }
  35803. <?php
  35804. namespace Symfony\Component\Console\Helper;
  35805. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35806. abstract class Helper implements HelperInterface
  35807. {
  35808. protected $helperSet = null;
  35809. public function setHelperSet(HelperSet $helperSet = null)
  35810. {
  35811. $this->helperSet = $helperSet;
  35812. }
  35813. public function getHelperSet()
  35814. {
  35815. return $this->helperSet;
  35816. }
  35817. public static function strlen($string)
  35818. {
  35819. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  35820. return \strlen($string);
  35821. }
  35822. return mb_strwidth($string, $encoding);
  35823. }
  35824. public static function formatTime($secs)
  35825. {
  35826. static $timeFormats = array(
  35827. array(0, '< 1 sec'),
  35828. array(1, '1 sec'),
  35829. array(2, 'secs', 1),
  35830. array(60, '1 min'),
  35831. array(120, 'mins', 60),
  35832. array(3600, '1 hr'),
  35833. array(7200, 'hrs', 3600),
  35834. array(86400, '1 day'),
  35835. array(172800, 'days', 86400),
  35836. );
  35837. foreach ($timeFormats as $index => $format) {
  35838. if ($secs >= $format[0]) {
  35839. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  35840. || $index == \count($timeFormats) - 1
  35841. ) {
  35842. if (2 == \count($format)) {
  35843. return $format[1];
  35844. }
  35845. return floor($secs / $format[2]).' '.$format[1];
  35846. }
  35847. }
  35848. }
  35849. }
  35850. public static function formatMemory($memory)
  35851. {
  35852. if ($memory >= 1024 * 1024 * 1024) {
  35853. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  35854. }
  35855. if ($memory >= 1024 * 1024) {
  35856. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  35857. }
  35858. if ($memory >= 1024) {
  35859. return sprintf('%d KiB', $memory / 1024);
  35860. }
  35861. return sprintf('%d B', $memory);
  35862. }
  35863. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  35864. {
  35865. return self::strlen(self::removeDecoration($formatter, $string));
  35866. }
  35867. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  35868. {
  35869. $isDecorated = $formatter->isDecorated();
  35870. $formatter->setDecorated(false);
  35871. $string = $formatter->format($string);
  35872. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  35873. $formatter->setDecorated($isDecorated);
  35874. return $string;
  35875. }
  35876. }
  35877. <?php
  35878. namespace Symfony\Component\Console\Helper;
  35879. interface HelperInterface
  35880. {
  35881. public function setHelperSet(HelperSet $helperSet = null);
  35882. public function getHelperSet();
  35883. public function getName();
  35884. }
  35885. <?php
  35886. namespace Symfony\Component\Console\Helper;
  35887. use Symfony\Component\Console\Command\Command;
  35888. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35889. class HelperSet implements \IteratorAggregate
  35890. {
  35891. private $helpers = array();
  35892. private $command;
  35893. public function __construct(array $helpers = array())
  35894. {
  35895. foreach ($helpers as $alias => $helper) {
  35896. $this->set($helper, \is_int($alias) ? null : $alias);
  35897. }
  35898. }
  35899. public function set(HelperInterface $helper, $alias = null)
  35900. {
  35901. $this->helpers[$helper->getName()] = $helper;
  35902. if (null !== $alias) {
  35903. $this->helpers[$alias] = $helper;
  35904. }
  35905. $helper->setHelperSet($this);
  35906. }
  35907. public function has($name)
  35908. {
  35909. return isset($this->helpers[$name]);
  35910. }
  35911. public function get($name)
  35912. {
  35913. if (!$this->has($name)) {
  35914. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  35915. }
  35916. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  35917. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35918. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  35919. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  35920. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  35921. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  35922. }
  35923. return $this->helpers[$name];
  35924. }
  35925. public function setCommand(Command $command = null)
  35926. {
  35927. $this->command = $command;
  35928. }
  35929. public function getCommand()
  35930. {
  35931. return $this->command;
  35932. }
  35933. public function getIterator()
  35934. {
  35935. return new \ArrayIterator($this->helpers);
  35936. }
  35937. }
  35938. <?php
  35939. namespace Symfony\Component\Console\Helper;
  35940. use Symfony\Component\Console\Input\InputAwareInterface;
  35941. use Symfony\Component\Console\Input\InputInterface;
  35942. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  35943. {
  35944. protected $input;
  35945. public function setInput(InputInterface $input)
  35946. {
  35947. $this->input = $input;
  35948. }
  35949. }
  35950. <?php
  35951. namespace Symfony\Component\Console\Helper;
  35952. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35953. use Symfony\Component\Console\Output\OutputInterface;
  35954. use Symfony\Component\Process\Exception\ProcessFailedException;
  35955. use Symfony\Component\Process\Process;
  35956. use Symfony\Component\Process\ProcessBuilder;
  35957. class ProcessHelper extends Helper
  35958. {
  35959. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  35960. {
  35961. if ($output instanceof ConsoleOutputInterface) {
  35962. $output = $output->getErrorOutput();
  35963. }
  35964. $formatter = $this->getHelperSet()->get('debug_formatter');
  35965. if (\is_array($cmd)) {
  35966. $process = ProcessBuilder::create($cmd)->getProcess();
  35967. } elseif ($cmd instanceof Process) {
  35968. $process = $cmd;
  35969. } else {
  35970. $process = new Process($cmd);
  35971. }
  35972. if ($verbosity <= $output->getVerbosity()) {
  35973. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  35974. }
  35975. if ($output->isDebug()) {
  35976. $callback = $this->wrapCallback($output, $process, $callback);
  35977. }
  35978. $process->run($callback);
  35979. if ($verbosity <= $output->getVerbosity()) {
  35980. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  35981. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  35982. }
  35983. if (!$process->isSuccessful() && null !== $error) {
  35984. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  35985. }
  35986. return $process;
  35987. }
  35988. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  35989. {
  35990. $process = $this->run($output, $cmd, $error, $callback);
  35991. if (!$process->isSuccessful()) {
  35992. throw new ProcessFailedException($process);
  35993. }
  35994. return $process;
  35995. }
  35996. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  35997. {
  35998. if ($output instanceof ConsoleOutputInterface) {
  35999. $output = $output->getErrorOutput();
  36000. }
  36001. $formatter = $this->getHelperSet()->get('debug_formatter');
  36002. $that = $this;
  36003. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  36004. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  36005. if (null !== $callback) {
  36006. \call_user_func($callback, $type, $buffer);
  36007. }
  36008. };
  36009. }
  36010. public function escapeString($str)
  36011. {
  36012. return str_replace('<', '\\<', $str);
  36013. }
  36014. public function getName()
  36015. {
  36016. return 'process';
  36017. }
  36018. }
  36019. <?php
  36020. namespace Symfony\Component\Console\Helper;
  36021. use Symfony\Component\Console\Exception\LogicException;
  36022. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36023. use Symfony\Component\Console\Output\OutputInterface;
  36024. class ProgressBar
  36025. {
  36026. private $barWidth = 28;
  36027. private $barChar;
  36028. private $emptyBarChar = '-';
  36029. private $progressChar = '>';
  36030. private $format;
  36031. private $internalFormat;
  36032. private $redrawFreq = 1;
  36033. private $output;
  36034. private $step = 0;
  36035. private $max;
  36036. private $startTime;
  36037. private $stepWidth;
  36038. private $percent = 0.0;
  36039. private $formatLineCount;
  36040. private $messages = array();
  36041. private $overwrite = true;
  36042. private $firstRun = true;
  36043. private static $formatters;
  36044. private static $formats;
  36045. public function __construct(OutputInterface $output, $max = 0)
  36046. {
  36047. if ($output instanceof ConsoleOutputInterface) {
  36048. $output = $output->getErrorOutput();
  36049. }
  36050. $this->output = $output;
  36051. $this->setMaxSteps($max);
  36052. if (!$this->output->isDecorated()) {
  36053. $this->overwrite = false;
  36054. $this->setRedrawFrequency($max / 10);
  36055. }
  36056. $this->startTime = time();
  36057. }
  36058. public static function setPlaceholderFormatterDefinition($name, $callable)
  36059. {
  36060. if (!self::$formatters) {
  36061. self::$formatters = self::initPlaceholderFormatters();
  36062. }
  36063. self::$formatters[$name] = $callable;
  36064. }
  36065. public static function getPlaceholderFormatterDefinition($name)
  36066. {
  36067. if (!self::$formatters) {
  36068. self::$formatters = self::initPlaceholderFormatters();
  36069. }
  36070. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36071. }
  36072. public static function setFormatDefinition($name, $format)
  36073. {
  36074. if (!self::$formats) {
  36075. self::$formats = self::initFormats();
  36076. }
  36077. self::$formats[$name] = $format;
  36078. }
  36079. public static function getFormatDefinition($name)
  36080. {
  36081. if (!self::$formats) {
  36082. self::$formats = self::initFormats();
  36083. }
  36084. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36085. }
  36086. public function setMessage($message, $name = 'message')
  36087. {
  36088. $this->messages[$name] = $message;
  36089. }
  36090. public function getMessage($name = 'message')
  36091. {
  36092. return $this->messages[$name];
  36093. }
  36094. public function getStartTime()
  36095. {
  36096. return $this->startTime;
  36097. }
  36098. public function getMaxSteps()
  36099. {
  36100. return $this->max;
  36101. }
  36102. public function getStep()
  36103. {
  36104. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  36105. return $this->getProgress();
  36106. }
  36107. public function getProgress()
  36108. {
  36109. return $this->step;
  36110. }
  36111. public function getStepWidth()
  36112. {
  36113. return $this->stepWidth;
  36114. }
  36115. public function getProgressPercent()
  36116. {
  36117. return $this->percent;
  36118. }
  36119. public function setBarWidth($size)
  36120. {
  36121. $this->barWidth = (int) $size;
  36122. }
  36123. public function getBarWidth()
  36124. {
  36125. return $this->barWidth;
  36126. }
  36127. public function setBarCharacter($char)
  36128. {
  36129. $this->barChar = $char;
  36130. }
  36131. public function getBarCharacter()
  36132. {
  36133. if (null === $this->barChar) {
  36134. return $this->max ? '=' : $this->emptyBarChar;
  36135. }
  36136. return $this->barChar;
  36137. }
  36138. public function setEmptyBarCharacter($char)
  36139. {
  36140. $this->emptyBarChar = $char;
  36141. }
  36142. public function getEmptyBarCharacter()
  36143. {
  36144. return $this->emptyBarChar;
  36145. }
  36146. public function setProgressCharacter($char)
  36147. {
  36148. $this->progressChar = $char;
  36149. }
  36150. public function getProgressCharacter()
  36151. {
  36152. return $this->progressChar;
  36153. }
  36154. public function setFormat($format)
  36155. {
  36156. $this->format = null;
  36157. $this->internalFormat = $format;
  36158. }
  36159. public function setRedrawFrequency($freq)
  36160. {
  36161. $this->redrawFreq = max((int) $freq, 1);
  36162. }
  36163. public function start($max = null)
  36164. {
  36165. $this->startTime = time();
  36166. $this->step = 0;
  36167. $this->percent = 0.0;
  36168. if (null !== $max) {
  36169. $this->setMaxSteps($max);
  36170. }
  36171. $this->display();
  36172. }
  36173. public function advance($step = 1)
  36174. {
  36175. $this->setProgress($this->step + $step);
  36176. }
  36177. public function setCurrent($step)
  36178. {
  36179. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  36180. $this->setProgress($step);
  36181. }
  36182. public function setOverwrite($overwrite)
  36183. {
  36184. $this->overwrite = (bool) $overwrite;
  36185. }
  36186. public function setProgress($step)
  36187. {
  36188. $step = (int) $step;
  36189. if ($step < $this->step) {
  36190. throw new LogicException('You can\'t regress the progress bar.');
  36191. }
  36192. if ($this->max && $step > $this->max) {
  36193. $this->max = $step;
  36194. }
  36195. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  36196. $currPeriod = (int) ($step / $this->redrawFreq);
  36197. $this->step = $step;
  36198. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  36199. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  36200. $this->display();
  36201. }
  36202. }
  36203. public function finish()
  36204. {
  36205. if (!$this->max) {
  36206. $this->max = $this->step;
  36207. }
  36208. if ($this->step === $this->max && !$this->overwrite) {
  36209. return;
  36210. }
  36211. $this->setProgress($this->max);
  36212. }
  36213. public function display()
  36214. {
  36215. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36216. return;
  36217. }
  36218. if (null === $this->format) {
  36219. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36220. }
  36221. $self = $this;
  36222. $output = $this->output;
  36223. $messages = $this->messages;
  36224. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  36225. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36226. $text = \call_user_func($formatter, $self, $output);
  36227. } elseif (isset($messages[$matches[1]])) {
  36228. $text = $messages[$matches[1]];
  36229. } else {
  36230. return $matches[0];
  36231. }
  36232. if (isset($matches[2])) {
  36233. $text = sprintf('%'.$matches[2], $text);
  36234. }
  36235. return $text;
  36236. }, $this->format));
  36237. }
  36238. public function clear()
  36239. {
  36240. if (!$this->overwrite) {
  36241. return;
  36242. }
  36243. if (null === $this->format) {
  36244. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36245. }
  36246. $this->overwrite('');
  36247. }
  36248. private function setRealFormat($format)
  36249. {
  36250. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  36251. $this->format = self::getFormatDefinition($format.'_nomax');
  36252. } elseif (null !== self::getFormatDefinition($format)) {
  36253. $this->format = self::getFormatDefinition($format);
  36254. } else {
  36255. $this->format = $format;
  36256. }
  36257. $this->formatLineCount = substr_count($this->format, "\n");
  36258. }
  36259. private function setMaxSteps($max)
  36260. {
  36261. $this->max = max(0, (int) $max);
  36262. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  36263. }
  36264. private function overwrite($message)
  36265. {
  36266. if ($this->overwrite) {
  36267. if (!$this->firstRun) {
  36268. $this->output->write("\x0D");
  36269. $this->output->write("\x1B[2K");
  36270. if ($this->formatLineCount > 0) {
  36271. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  36272. }
  36273. }
  36274. } elseif ($this->step > 0) {
  36275. $this->output->writeln('');
  36276. }
  36277. $this->firstRun = false;
  36278. $this->output->write($message);
  36279. }
  36280. private function determineBestFormat()
  36281. {
  36282. switch ($this->output->getVerbosity()) {
  36283. case OutputInterface::VERBOSITY_VERBOSE:
  36284. return $this->max ? 'verbose' : 'verbose_nomax';
  36285. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36286. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  36287. case OutputInterface::VERBOSITY_DEBUG:
  36288. return $this->max ? 'debug' : 'debug_nomax';
  36289. default:
  36290. return $this->max ? 'normal' : 'normal_nomax';
  36291. }
  36292. }
  36293. private static function initPlaceholderFormatters()
  36294. {
  36295. return array(
  36296. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  36297. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  36298. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  36299. if ($completeBars < $bar->getBarWidth()) {
  36300. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  36301. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  36302. }
  36303. return $display;
  36304. },
  36305. 'elapsed' => function (ProgressBar $bar) {
  36306. return Helper::formatTime(time() - $bar->getStartTime());
  36307. },
  36308. 'remaining' => function (ProgressBar $bar) {
  36309. if (!$bar->getMaxSteps()) {
  36310. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  36311. }
  36312. if (!$bar->getProgress()) {
  36313. $remaining = 0;
  36314. } else {
  36315. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  36316. }
  36317. return Helper::formatTime($remaining);
  36318. },
  36319. 'estimated' => function (ProgressBar $bar) {
  36320. if (!$bar->getMaxSteps()) {
  36321. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  36322. }
  36323. if (!$bar->getProgress()) {
  36324. $estimated = 0;
  36325. } else {
  36326. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  36327. }
  36328. return Helper::formatTime($estimated);
  36329. },
  36330. 'memory' => function (ProgressBar $bar) {
  36331. return Helper::formatMemory(memory_get_usage(true));
  36332. },
  36333. 'current' => function (ProgressBar $bar) {
  36334. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  36335. },
  36336. 'max' => function (ProgressBar $bar) {
  36337. return $bar->getMaxSteps();
  36338. },
  36339. 'percent' => function (ProgressBar $bar) {
  36340. return floor($bar->getProgressPercent() * 100);
  36341. },
  36342. );
  36343. }
  36344. private static function initFormats()
  36345. {
  36346. return array(
  36347. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  36348. 'normal_nomax' => ' %current% [%bar%]',
  36349. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  36350. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36351. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  36352. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36353. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  36354. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  36355. );
  36356. }
  36357. }
  36358. <?php
  36359. namespace Symfony\Component\Console\Helper;
  36360. use Symfony\Component\Console\Exception\LogicException;
  36361. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36362. use Symfony\Component\Console\Output\NullOutput;
  36363. use Symfony\Component\Console\Output\OutputInterface;
  36364. class ProgressHelper extends Helper
  36365. {
  36366. const FORMAT_QUIET = ' %percent%%';
  36367. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  36368. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  36369. const FORMAT_QUIET_NOMAX = ' %current%';
  36370. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  36371. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  36372. private $barWidth = 28;
  36373. private $barChar = '=';
  36374. private $emptyBarChar = '-';
  36375. private $progressChar = '>';
  36376. private $format = null;
  36377. private $redrawFreq = 1;
  36378. private $lastMessagesLength;
  36379. private $barCharOriginal;
  36380. private $output;
  36381. private $current;
  36382. private $max;
  36383. private $startTime;
  36384. private $defaultFormatVars = array(
  36385. 'current',
  36386. 'max',
  36387. 'bar',
  36388. 'percent',
  36389. 'elapsed',
  36390. );
  36391. private $formatVars;
  36392. private $widths = array(
  36393. 'current' => 4,
  36394. 'max' => 4,
  36395. 'percent' => 3,
  36396. 'elapsed' => 6,
  36397. );
  36398. private $timeFormats = array(
  36399. array(0, '???'),
  36400. array(2, '1 sec'),
  36401. array(59, 'secs', 1),
  36402. array(60, '1 min'),
  36403. array(3600, 'mins', 60),
  36404. array(5400, '1 hr'),
  36405. array(86400, 'hrs', 3600),
  36406. array(129600, '1 day'),
  36407. array(604800, 'days', 86400),
  36408. );
  36409. public function __construct($triggerDeprecationError = true)
  36410. {
  36411. if ($triggerDeprecationError) {
  36412. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  36413. }
  36414. }
  36415. public function setBarWidth($size)
  36416. {
  36417. $this->barWidth = (int) $size;
  36418. }
  36419. public function setBarCharacter($char)
  36420. {
  36421. $this->barChar = $char;
  36422. }
  36423. public function setEmptyBarCharacter($char)
  36424. {
  36425. $this->emptyBarChar = $char;
  36426. }
  36427. public function setProgressCharacter($char)
  36428. {
  36429. $this->progressChar = $char;
  36430. }
  36431. public function setFormat($format)
  36432. {
  36433. $this->format = $format;
  36434. }
  36435. public function setRedrawFrequency($freq)
  36436. {
  36437. $this->redrawFreq = (int) $freq;
  36438. }
  36439. public function start(OutputInterface $output, $max = null)
  36440. {
  36441. if ($output instanceof ConsoleOutputInterface) {
  36442. $output = $output->getErrorOutput();
  36443. }
  36444. $this->startTime = time();
  36445. $this->current = 0;
  36446. $this->max = (int) $max;
  36447. $this->output = $output->isDecorated() ? $output : new NullOutput();
  36448. $this->lastMessagesLength = 0;
  36449. $this->barCharOriginal = '';
  36450. if (null === $this->format) {
  36451. switch ($output->getVerbosity()) {
  36452. case OutputInterface::VERBOSITY_QUIET:
  36453. $this->format = self::FORMAT_QUIET_NOMAX;
  36454. if ($this->max > 0) {
  36455. $this->format = self::FORMAT_QUIET;
  36456. }
  36457. break;
  36458. case OutputInterface::VERBOSITY_VERBOSE:
  36459. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36460. case OutputInterface::VERBOSITY_DEBUG:
  36461. $this->format = self::FORMAT_VERBOSE_NOMAX;
  36462. if ($this->max > 0) {
  36463. $this->format = self::FORMAT_VERBOSE;
  36464. }
  36465. break;
  36466. default:
  36467. $this->format = self::FORMAT_NORMAL_NOMAX;
  36468. if ($this->max > 0) {
  36469. $this->format = self::FORMAT_NORMAL;
  36470. }
  36471. break;
  36472. }
  36473. }
  36474. $this->initialize();
  36475. }
  36476. public function advance($step = 1, $redraw = false)
  36477. {
  36478. $this->setCurrent($this->current + $step, $redraw);
  36479. }
  36480. public function setCurrent($current, $redraw = false)
  36481. {
  36482. if (null === $this->startTime) {
  36483. throw new LogicException('You must start the progress bar before calling setCurrent().');
  36484. }
  36485. $current = (int) $current;
  36486. if ($current < $this->current) {
  36487. throw new LogicException('You can\'t regress the progress bar');
  36488. }
  36489. if (0 === $this->current) {
  36490. $redraw = true;
  36491. }
  36492. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  36493. $this->current = $current;
  36494. $currPeriod = (int) ($this->current / $this->redrawFreq);
  36495. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  36496. $this->display();
  36497. }
  36498. }
  36499. public function display($finish = false)
  36500. {
  36501. if (null === $this->startTime) {
  36502. throw new LogicException('You must start the progress bar before calling display().');
  36503. }
  36504. $message = $this->format;
  36505. foreach ($this->generate($finish) as $name => $value) {
  36506. $message = str_replace("%{$name}%", $value, $message);
  36507. }
  36508. $this->overwrite($this->output, $message);
  36509. }
  36510. public function clear()
  36511. {
  36512. $this->overwrite($this->output, '');
  36513. }
  36514. public function finish()
  36515. {
  36516. if (null === $this->startTime) {
  36517. throw new LogicException('You must start the progress bar before calling finish().');
  36518. }
  36519. if (null !== $this->startTime) {
  36520. if (!$this->max) {
  36521. $this->barChar = $this->barCharOriginal;
  36522. $this->display(true);
  36523. }
  36524. $this->startTime = null;
  36525. $this->output->writeln('');
  36526. $this->output = null;
  36527. }
  36528. }
  36529. private function initialize()
  36530. {
  36531. $this->formatVars = array();
  36532. foreach ($this->defaultFormatVars as $var) {
  36533. if (false !== strpos($this->format, "%{$var}%")) {
  36534. $this->formatVars[$var] = true;
  36535. }
  36536. }
  36537. if ($this->max > 0) {
  36538. $this->widths['max'] = $this->strlen($this->max);
  36539. $this->widths['current'] = $this->widths['max'];
  36540. } else {
  36541. $this->barCharOriginal = $this->barChar;
  36542. $this->barChar = $this->emptyBarChar;
  36543. }
  36544. }
  36545. private function generate($finish = false)
  36546. {
  36547. $vars = array();
  36548. $percent = 0;
  36549. if ($this->max > 0) {
  36550. $percent = (float) $this->current / $this->max;
  36551. }
  36552. if (isset($this->formatVars['bar'])) {
  36553. if ($this->max > 0) {
  36554. $completeBars = floor($percent * $this->barWidth);
  36555. } else {
  36556. if (!$finish) {
  36557. $completeBars = floor($this->current % $this->barWidth);
  36558. } else {
  36559. $completeBars = $this->barWidth;
  36560. }
  36561. }
  36562. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  36563. $bar = str_repeat($this->barChar, $completeBars);
  36564. if ($completeBars < $this->barWidth) {
  36565. $bar .= $this->progressChar;
  36566. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  36567. }
  36568. $vars['bar'] = $bar;
  36569. }
  36570. if (isset($this->formatVars['elapsed'])) {
  36571. $elapsed = time() - $this->startTime;
  36572. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  36573. }
  36574. if (isset($this->formatVars['current'])) {
  36575. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  36576. }
  36577. if (isset($this->formatVars['max'])) {
  36578. $vars['max'] = $this->max;
  36579. }
  36580. if (isset($this->formatVars['percent'])) {
  36581. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  36582. }
  36583. return $vars;
  36584. }
  36585. private function humaneTime($secs)
  36586. {
  36587. $text = '';
  36588. foreach ($this->timeFormats as $format) {
  36589. if ($secs < $format[0]) {
  36590. if (2 == \count($format)) {
  36591. $text = $format[1];
  36592. break;
  36593. } else {
  36594. $text = ceil($secs / $format[2]).' '.$format[1];
  36595. break;
  36596. }
  36597. }
  36598. }
  36599. return $text;
  36600. }
  36601. private function overwrite(OutputInterface $output, $message)
  36602. {
  36603. $length = $this->strlen($message);
  36604. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  36605. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  36606. }
  36607. $output->write("\x0D");
  36608. $output->write($message);
  36609. $this->lastMessagesLength = $this->strlen($message);
  36610. }
  36611. public function getName()
  36612. {
  36613. return 'progress';
  36614. }
  36615. }
  36616. <?php
  36617. namespace Symfony\Component\Console\Helper;
  36618. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36619. use Symfony\Component\Console\Exception\LogicException;
  36620. use Symfony\Component\Console\Output\OutputInterface;
  36621. class ProgressIndicator
  36622. {
  36623. private $output;
  36624. private $startTime;
  36625. private $format;
  36626. private $message;
  36627. private $indicatorValues;
  36628. private $indicatorCurrent;
  36629. private $indicatorChangeInterval;
  36630. private $indicatorUpdateTime;
  36631. private $started = false;
  36632. private static $formatters;
  36633. private static $formats;
  36634. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  36635. {
  36636. $this->output = $output;
  36637. if (null === $format) {
  36638. $format = $this->determineBestFormat();
  36639. }
  36640. if (null === $indicatorValues) {
  36641. $indicatorValues = array('-', '\\', '|', '/');
  36642. }
  36643. $indicatorValues = array_values($indicatorValues);
  36644. if (2 > \count($indicatorValues)) {
  36645. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  36646. }
  36647. $this->format = self::getFormatDefinition($format);
  36648. $this->indicatorChangeInterval = $indicatorChangeInterval;
  36649. $this->indicatorValues = $indicatorValues;
  36650. $this->startTime = time();
  36651. }
  36652. public function setMessage($message)
  36653. {
  36654. $this->message = $message;
  36655. $this->display();
  36656. }
  36657. public function getMessage()
  36658. {
  36659. return $this->message;
  36660. }
  36661. public function getStartTime()
  36662. {
  36663. return $this->startTime;
  36664. }
  36665. public function getCurrentValue()
  36666. {
  36667. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  36668. }
  36669. public function start($message)
  36670. {
  36671. if ($this->started) {
  36672. throw new LogicException('Progress indicator already started.');
  36673. }
  36674. $this->message = $message;
  36675. $this->started = true;
  36676. $this->startTime = time();
  36677. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  36678. $this->indicatorCurrent = 0;
  36679. $this->display();
  36680. }
  36681. public function advance()
  36682. {
  36683. if (!$this->started) {
  36684. throw new LogicException('Progress indicator has not yet been started.');
  36685. }
  36686. if (!$this->output->isDecorated()) {
  36687. return;
  36688. }
  36689. $currentTime = $this->getCurrentTimeInMilliseconds();
  36690. if ($currentTime < $this->indicatorUpdateTime) {
  36691. return;
  36692. }
  36693. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  36694. ++$this->indicatorCurrent;
  36695. $this->display();
  36696. }
  36697. public function finish($message)
  36698. {
  36699. if (!$this->started) {
  36700. throw new LogicException('Progress indicator has not yet been started.');
  36701. }
  36702. $this->message = $message;
  36703. $this->display();
  36704. $this->output->writeln('');
  36705. $this->started = false;
  36706. }
  36707. public static function getFormatDefinition($name)
  36708. {
  36709. if (!self::$formats) {
  36710. self::$formats = self::initFormats();
  36711. }
  36712. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36713. }
  36714. public static function setPlaceholderFormatterDefinition($name, $callable)
  36715. {
  36716. if (!self::$formatters) {
  36717. self::$formatters = self::initPlaceholderFormatters();
  36718. }
  36719. self::$formatters[$name] = $callable;
  36720. }
  36721. public static function getPlaceholderFormatterDefinition($name)
  36722. {
  36723. if (!self::$formatters) {
  36724. self::$formatters = self::initPlaceholderFormatters();
  36725. }
  36726. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36727. }
  36728. private function display()
  36729. {
  36730. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36731. return;
  36732. }
  36733. $self = $this;
  36734. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  36735. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36736. return \call_user_func($formatter, $self);
  36737. }
  36738. return $matches[0];
  36739. }, $this->format));
  36740. }
  36741. private function determineBestFormat()
  36742. {
  36743. switch ($this->output->getVerbosity()) {
  36744. case OutputInterface::VERBOSITY_VERBOSE:
  36745. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  36746. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36747. case OutputInterface::VERBOSITY_DEBUG:
  36748. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  36749. default:
  36750. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  36751. }
  36752. }
  36753. private function overwrite($message)
  36754. {
  36755. if ($this->output->isDecorated()) {
  36756. $this->output->write("\x0D\x1B[2K");
  36757. $this->output->write($message);
  36758. } else {
  36759. $this->output->writeln($message);
  36760. }
  36761. }
  36762. private function getCurrentTimeInMilliseconds()
  36763. {
  36764. return round(microtime(true) * 1000);
  36765. }
  36766. private static function initPlaceholderFormatters()
  36767. {
  36768. return array(
  36769. 'indicator' => function (ProgressIndicator $indicator) {
  36770. return $indicator->getCurrentValue();
  36771. },
  36772. 'message' => function (ProgressIndicator $indicator) {
  36773. return $indicator->getMessage();
  36774. },
  36775. 'elapsed' => function (ProgressIndicator $indicator) {
  36776. return Helper::formatTime(time() - $indicator->getStartTime());
  36777. },
  36778. 'memory' => function () {
  36779. return Helper::formatMemory(memory_get_usage(true));
  36780. },
  36781. );
  36782. }
  36783. private static function initFormats()
  36784. {
  36785. return array(
  36786. 'normal' => ' %indicator% %message%',
  36787. 'normal_no_ansi' => ' %message%',
  36788. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  36789. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  36790. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  36791. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  36792. );
  36793. }
  36794. }
  36795. <?php
  36796. namespace Symfony\Component\Console\Helper;
  36797. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36798. use Symfony\Component\Console\Exception\RuntimeException;
  36799. use Symfony\Component\Console\Formatter\OutputFormatter;
  36800. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  36801. use Symfony\Component\Console\Input\InputInterface;
  36802. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36803. use Symfony\Component\Console\Output\OutputInterface;
  36804. use Symfony\Component\Console\Question\ChoiceQuestion;
  36805. use Symfony\Component\Console\Question\Question;
  36806. class QuestionHelper extends Helper
  36807. {
  36808. private $inputStream;
  36809. private static $shell;
  36810. private static $stty;
  36811. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  36812. {
  36813. if ($output instanceof ConsoleOutputInterface) {
  36814. $output = $output->getErrorOutput();
  36815. }
  36816. if (!$input->isInteractive()) {
  36817. $default = $question->getDefault();
  36818. if (null !== $default && $question instanceof ChoiceQuestion) {
  36819. $choices = $question->getChoices();
  36820. if (!$question->isMultiselect()) {
  36821. return isset($choices[$default]) ? $choices[$default] : $default;
  36822. }
  36823. $default = explode(',', $default);
  36824. foreach ($default as $k => $v) {
  36825. $v = trim($v);
  36826. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  36827. }
  36828. }
  36829. return $default;
  36830. }
  36831. if (!$question->getValidator()) {
  36832. return $this->doAsk($output, $question);
  36833. }
  36834. $that = $this;
  36835. $interviewer = function () use ($output, $question, $that) {
  36836. return $that->doAsk($output, $question);
  36837. };
  36838. return $this->validateAttempts($interviewer, $output, $question);
  36839. }
  36840. public function setInputStream($stream)
  36841. {
  36842. if (!\is_resource($stream)) {
  36843. throw new InvalidArgumentException('Input stream must be a valid resource.');
  36844. }
  36845. $this->inputStream = $stream;
  36846. }
  36847. public function getInputStream()
  36848. {
  36849. return $this->inputStream;
  36850. }
  36851. public function getName()
  36852. {
  36853. return 'question';
  36854. }
  36855. public function doAsk(OutputInterface $output, Question $question)
  36856. {
  36857. $this->writePrompt($output, $question);
  36858. $inputStream = $this->inputStream ?: STDIN;
  36859. $autocomplete = $question->getAutocompleterValues();
  36860. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  36861. $ret = false;
  36862. if ($question->isHidden()) {
  36863. try {
  36864. $ret = trim($this->getHiddenResponse($output, $inputStream));
  36865. } catch (RuntimeException $e) {
  36866. if (!$question->isHiddenFallback()) {
  36867. throw $e;
  36868. }
  36869. }
  36870. }
  36871. if (false === $ret) {
  36872. $ret = fgets($inputStream, 4096);
  36873. if (false === $ret) {
  36874. throw new RuntimeException('Aborted');
  36875. }
  36876. $ret = trim($ret);
  36877. }
  36878. } else {
  36879. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  36880. }
  36881. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  36882. if ($normalizer = $question->getNormalizer()) {
  36883. return $normalizer($ret);
  36884. }
  36885. return $ret;
  36886. }
  36887. protected function writePrompt(OutputInterface $output, Question $question)
  36888. {
  36889. $message = $question->getQuestion();
  36890. if ($question instanceof ChoiceQuestion) {
  36891. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  36892. $messages = (array) $question->getQuestion();
  36893. foreach ($question->getChoices() as $key => $value) {
  36894. $width = $maxWidth - $this->strlen($key);
  36895. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  36896. }
  36897. $output->writeln($messages);
  36898. $message = $question->getPrompt();
  36899. }
  36900. $output->write($message);
  36901. }
  36902. protected function writeError(OutputInterface $output, \Exception $error)
  36903. {
  36904. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  36905. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  36906. } else {
  36907. $message = '<error>'.$error->getMessage().'</error>';
  36908. }
  36909. $output->writeln($message);
  36910. }
  36911. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  36912. {
  36913. $ret = '';
  36914. $i = 0;
  36915. $ofs = -1;
  36916. $matches = $autocomplete;
  36917. $numMatches = \count($matches);
  36918. $sttyMode = shell_exec('stty -g');
  36919. shell_exec('stty -icanon -echo');
  36920. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  36921. while (!feof($inputStream)) {
  36922. $c = fread($inputStream, 1);
  36923. if ("\177" === $c) {
  36924. if (0 === $numMatches && 0 !== $i) {
  36925. --$i;
  36926. $output->write("\033[1D");
  36927. }
  36928. if (0 === $i) {
  36929. $ofs = -1;
  36930. $matches = $autocomplete;
  36931. $numMatches = \count($matches);
  36932. } else {
  36933. $numMatches = 0;
  36934. }
  36935. $ret = substr($ret, 0, $i);
  36936. } elseif ("\033" === $c) {
  36937. $c .= fread($inputStream, 2);
  36938. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  36939. if ('A' === $c[2] && -1 === $ofs) {
  36940. $ofs = 0;
  36941. }
  36942. if (0 === $numMatches) {
  36943. continue;
  36944. }
  36945. $ofs += ('A' === $c[2]) ? -1 : 1;
  36946. $ofs = ($numMatches + $ofs) % $numMatches;
  36947. }
  36948. } elseif (\ord($c) < 32) {
  36949. if ("\t" === $c || "\n" === $c) {
  36950. if ($numMatches > 0 && -1 !== $ofs) {
  36951. $ret = $matches[$ofs];
  36952. $output->write(substr($ret, $i));
  36953. $i = \strlen($ret);
  36954. }
  36955. if ("\n" === $c) {
  36956. $output->write($c);
  36957. break;
  36958. }
  36959. $numMatches = 0;
  36960. }
  36961. continue;
  36962. } else {
  36963. $output->write($c);
  36964. $ret .= $c;
  36965. ++$i;
  36966. $numMatches = 0;
  36967. $ofs = 0;
  36968. foreach ($autocomplete as $value) {
  36969. if (0 === strpos($value, $ret)) {
  36970. $matches[$numMatches++] = $value;
  36971. }
  36972. }
  36973. }
  36974. $output->write("\033[K");
  36975. if ($numMatches > 0 && -1 !== $ofs) {
  36976. $output->write("\0337");
  36977. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  36978. $output->write("\0338");
  36979. }
  36980. }
  36981. shell_exec(sprintf('stty %s', $sttyMode));
  36982. return $ret;
  36983. }
  36984. private function getHiddenResponse(OutputInterface $output, $inputStream)
  36985. {
  36986. if ('\\' === \DIRECTORY_SEPARATOR) {
  36987. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  36988. if ('phar:' === substr(__FILE__, 0, 5)) {
  36989. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  36990. copy($exe, $tmpExe);
  36991. $exe = $tmpExe;
  36992. }
  36993. $value = rtrim(shell_exec($exe));
  36994. $output->writeln('');
  36995. if (isset($tmpExe)) {
  36996. unlink($tmpExe);
  36997. }
  36998. return $value;
  36999. }
  37000. if ($this->hasSttyAvailable()) {
  37001. $sttyMode = shell_exec('stty -g');
  37002. shell_exec('stty -echo');
  37003. $value = fgets($inputStream, 4096);
  37004. shell_exec(sprintf('stty %s', $sttyMode));
  37005. if (false === $value) {
  37006. throw new RuntimeException('Aborted');
  37007. }
  37008. $value = trim($value);
  37009. $output->writeln('');
  37010. return $value;
  37011. }
  37012. if (false !== $shell = $this->getShell()) {
  37013. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  37014. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  37015. $value = rtrim(shell_exec($command));
  37016. $output->writeln('');
  37017. return $value;
  37018. }
  37019. throw new RuntimeException('Unable to hide the response.');
  37020. }
  37021. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  37022. {
  37023. $error = null;
  37024. $attempts = $question->getMaxAttempts();
  37025. while (null === $attempts || $attempts--) {
  37026. if (null !== $error) {
  37027. $this->writeError($output, $error);
  37028. }
  37029. try {
  37030. return \call_user_func($question->getValidator(), $interviewer());
  37031. } catch (RuntimeException $e) {
  37032. throw $e;
  37033. } catch (\Exception $error) {
  37034. }
  37035. }
  37036. throw $error;
  37037. }
  37038. private function getShell()
  37039. {
  37040. if (null !== self::$shell) {
  37041. return self::$shell;
  37042. }
  37043. self::$shell = false;
  37044. if (file_exists('/usr/bin/env')) {
  37045. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  37046. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  37047. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  37048. self::$shell = $sh;
  37049. break;
  37050. }
  37051. }
  37052. }
  37053. return self::$shell;
  37054. }
  37055. private function hasSttyAvailable()
  37056. {
  37057. if (null !== self::$stty) {
  37058. return self::$stty;
  37059. }
  37060. exec('stty 2>&1', $output, $exitcode);
  37061. return self::$stty = 0 === $exitcode;
  37062. }
  37063. }
  37064. <?php
  37065. namespace Symfony\Component\Console\Helper;
  37066. use Symfony\Component\Console\Exception\LogicException;
  37067. use Symfony\Component\Console\Formatter\OutputFormatter;
  37068. use Symfony\Component\Console\Input\InputInterface;
  37069. use Symfony\Component\Console\Output\OutputInterface;
  37070. use Symfony\Component\Console\Question\ChoiceQuestion;
  37071. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37072. use Symfony\Component\Console\Question\Question;
  37073. use Symfony\Component\Console\Style\SymfonyStyle;
  37074. class SymfonyQuestionHelper extends QuestionHelper
  37075. {
  37076. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  37077. {
  37078. $validator = $question->getValidator();
  37079. $question->setValidator(function ($value) use ($validator) {
  37080. if (null !== $validator) {
  37081. $value = $validator($value);
  37082. } else {
  37083. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  37084. throw new LogicException('A value is required.');
  37085. }
  37086. }
  37087. return $value;
  37088. });
  37089. return parent::ask($input, $output, $question);
  37090. }
  37091. protected function writePrompt(OutputInterface $output, Question $question)
  37092. {
  37093. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  37094. $default = $question->getDefault();
  37095. switch (true) {
  37096. case null === $default:
  37097. $text = sprintf(' <info>%s</info>:', $text);
  37098. break;
  37099. case $question instanceof ConfirmationQuestion:
  37100. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  37101. break;
  37102. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  37103. $choices = $question->getChoices();
  37104. $default = explode(',', $default);
  37105. foreach ($default as $key => $value) {
  37106. $default[$key] = $choices[trim($value)];
  37107. }
  37108. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  37109. break;
  37110. case $question instanceof ChoiceQuestion:
  37111. $choices = $question->getChoices();
  37112. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  37113. break;
  37114. default:
  37115. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  37116. }
  37117. $output->writeln($text);
  37118. if ($question instanceof ChoiceQuestion) {
  37119. $width = max(array_map('strlen', array_keys($question->getChoices())));
  37120. foreach ($question->getChoices() as $key => $value) {
  37121. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  37122. }
  37123. }
  37124. $output->write(' > ');
  37125. }
  37126. protected function writeError(OutputInterface $output, \Exception $error)
  37127. {
  37128. if ($output instanceof SymfonyStyle) {
  37129. $output->newLine();
  37130. $output->error($error->getMessage());
  37131. return;
  37132. }
  37133. parent::writeError($output, $error);
  37134. }
  37135. }
  37136. <?php
  37137. namespace Symfony\Component\Console\Helper;
  37138. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37139. use Symfony\Component\Console\Output\OutputInterface;
  37140. class Table
  37141. {
  37142. private $headers = array();
  37143. private $rows = array();
  37144. private $columnWidths = array();
  37145. private $numberOfColumns;
  37146. private $output;
  37147. private $style;
  37148. private $columnStyles = array();
  37149. private static $styles;
  37150. public function __construct(OutputInterface $output)
  37151. {
  37152. $this->output = $output;
  37153. if (!self::$styles) {
  37154. self::$styles = self::initStyles();
  37155. }
  37156. $this->setStyle('default');
  37157. }
  37158. public static function setStyleDefinition($name, TableStyle $style)
  37159. {
  37160. if (!self::$styles) {
  37161. self::$styles = self::initStyles();
  37162. }
  37163. self::$styles[$name] = $style;
  37164. }
  37165. public static function getStyleDefinition($name)
  37166. {
  37167. if (!self::$styles) {
  37168. self::$styles = self::initStyles();
  37169. }
  37170. if (isset(self::$styles[$name])) {
  37171. return self::$styles[$name];
  37172. }
  37173. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37174. }
  37175. public function setStyle($name)
  37176. {
  37177. $this->style = $this->resolveStyle($name);
  37178. return $this;
  37179. }
  37180. public function getStyle()
  37181. {
  37182. return $this->style;
  37183. }
  37184. public function setColumnStyle($columnIndex, $name)
  37185. {
  37186. $columnIndex = (int) $columnIndex;
  37187. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  37188. return $this;
  37189. }
  37190. public function getColumnStyle($columnIndex)
  37191. {
  37192. if (isset($this->columnStyles[$columnIndex])) {
  37193. return $this->columnStyles[$columnIndex];
  37194. }
  37195. return $this->getStyle();
  37196. }
  37197. public function setHeaders(array $headers)
  37198. {
  37199. $headers = array_values($headers);
  37200. if (!empty($headers) && !\is_array($headers[0])) {
  37201. $headers = array($headers);
  37202. }
  37203. $this->headers = $headers;
  37204. return $this;
  37205. }
  37206. public function setRows(array $rows)
  37207. {
  37208. $this->rows = array();
  37209. return $this->addRows($rows);
  37210. }
  37211. public function addRows(array $rows)
  37212. {
  37213. foreach ($rows as $row) {
  37214. $this->addRow($row);
  37215. }
  37216. return $this;
  37217. }
  37218. public function addRow($row)
  37219. {
  37220. if ($row instanceof TableSeparator) {
  37221. $this->rows[] = $row;
  37222. return $this;
  37223. }
  37224. if (!\is_array($row)) {
  37225. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  37226. }
  37227. $this->rows[] = array_values($row);
  37228. return $this;
  37229. }
  37230. public function setRow($column, array $row)
  37231. {
  37232. $this->rows[$column] = $row;
  37233. return $this;
  37234. }
  37235. public function render()
  37236. {
  37237. $this->calculateNumberOfColumns();
  37238. $rows = $this->buildTableRows($this->rows);
  37239. $headers = $this->buildTableRows($this->headers);
  37240. $this->calculateColumnsWidth(array_merge($headers, $rows));
  37241. $this->renderRowSeparator();
  37242. if (!empty($headers)) {
  37243. foreach ($headers as $header) {
  37244. $this->renderRow($header, $this->style->getCellHeaderFormat());
  37245. $this->renderRowSeparator();
  37246. }
  37247. }
  37248. foreach ($rows as $row) {
  37249. if ($row instanceof TableSeparator) {
  37250. $this->renderRowSeparator();
  37251. } else {
  37252. $this->renderRow($row, $this->style->getCellRowFormat());
  37253. }
  37254. }
  37255. if (!empty($rows)) {
  37256. $this->renderRowSeparator();
  37257. }
  37258. $this->cleanup();
  37259. }
  37260. private function renderRowSeparator()
  37261. {
  37262. if (0 === $count = $this->numberOfColumns) {
  37263. return;
  37264. }
  37265. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  37266. return;
  37267. }
  37268. $markup = $this->style->getCrossingChar();
  37269. for ($column = 0; $column < $count; ++$column) {
  37270. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  37271. }
  37272. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  37273. }
  37274. private function renderColumnSeparator()
  37275. {
  37276. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  37277. }
  37278. private function renderRow(array $row, $cellFormat)
  37279. {
  37280. if (empty($row)) {
  37281. return;
  37282. }
  37283. $rowContent = $this->renderColumnSeparator();
  37284. foreach ($this->getRowColumns($row) as $column) {
  37285. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  37286. $rowContent .= $this->renderColumnSeparator();
  37287. }
  37288. $this->output->writeln($rowContent);
  37289. }
  37290. private function renderCell(array $row, $column, $cellFormat)
  37291. {
  37292. $cell = isset($row[$column]) ? $row[$column] : '';
  37293. $width = $this->columnWidths[$column];
  37294. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37295. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  37296. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  37297. }
  37298. }
  37299. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  37300. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  37301. }
  37302. $style = $this->getColumnStyle($column);
  37303. if ($cell instanceof TableSeparator) {
  37304. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  37305. }
  37306. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37307. $content = sprintf($style->getCellRowContentFormat(), $cell);
  37308. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  37309. }
  37310. private function calculateNumberOfColumns()
  37311. {
  37312. if (null !== $this->numberOfColumns) {
  37313. return;
  37314. }
  37315. $columns = array(0);
  37316. foreach (array_merge($this->headers, $this->rows) as $row) {
  37317. if ($row instanceof TableSeparator) {
  37318. continue;
  37319. }
  37320. $columns[] = $this->getNumberOfColumns($row);
  37321. }
  37322. $this->numberOfColumns = max($columns);
  37323. }
  37324. private function buildTableRows($rows)
  37325. {
  37326. $unmergedRows = array();
  37327. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  37328. $rows = $this->fillNextRows($rows, $rowKey);
  37329. foreach ($rows[$rowKey] as $column => $cell) {
  37330. if (!strstr($cell, "\n")) {
  37331. continue;
  37332. }
  37333. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37334. foreach ($lines as $lineKey => $line) {
  37335. if ($cell instanceof TableCell) {
  37336. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  37337. }
  37338. if (0 === $lineKey) {
  37339. $rows[$rowKey][$column] = $line;
  37340. } else {
  37341. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  37342. }
  37343. }
  37344. }
  37345. }
  37346. $tableRows = array();
  37347. foreach ($rows as $rowKey => $row) {
  37348. $tableRows[] = $this->fillCells($row);
  37349. if (isset($unmergedRows[$rowKey])) {
  37350. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  37351. }
  37352. }
  37353. return $tableRows;
  37354. }
  37355. private function fillNextRows(array $rows, $line)
  37356. {
  37357. $unmergedRows = array();
  37358. foreach ($rows[$line] as $column => $cell) {
  37359. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  37360. $nbLines = $cell->getRowspan() - 1;
  37361. $lines = array($cell);
  37362. if (strstr($cell, "\n")) {
  37363. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37364. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  37365. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  37366. unset($lines[0]);
  37367. }
  37368. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  37369. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37370. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  37371. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  37372. if ($nbLines === $unmergedRowKey - $line) {
  37373. break;
  37374. }
  37375. }
  37376. }
  37377. }
  37378. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37379. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  37380. foreach ($unmergedRow as $cellKey => $cell) {
  37381. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  37382. }
  37383. } else {
  37384. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  37385. foreach ($unmergedRow as $column => $cell) {
  37386. if (!empty($cell)) {
  37387. $row[$column] = $unmergedRow[$column];
  37388. }
  37389. }
  37390. array_splice($rows, $unmergedRowKey, 0, array($row));
  37391. }
  37392. }
  37393. return $rows;
  37394. }
  37395. private function fillCells($row)
  37396. {
  37397. $newRow = array();
  37398. foreach ($row as $column => $cell) {
  37399. $newRow[] = $cell;
  37400. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37401. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  37402. $newRow[] = '';
  37403. }
  37404. }
  37405. }
  37406. return $newRow ?: $row;
  37407. }
  37408. private function copyRow(array $rows, $line)
  37409. {
  37410. $row = $rows[$line];
  37411. foreach ($row as $cellKey => $cellValue) {
  37412. $row[$cellKey] = '';
  37413. if ($cellValue instanceof TableCell) {
  37414. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  37415. }
  37416. }
  37417. return $row;
  37418. }
  37419. private function getNumberOfColumns(array $row)
  37420. {
  37421. $columns = \count($row);
  37422. foreach ($row as $column) {
  37423. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  37424. }
  37425. return $columns;
  37426. }
  37427. private function getRowColumns(array $row)
  37428. {
  37429. $columns = range(0, $this->numberOfColumns - 1);
  37430. foreach ($row as $cellKey => $cell) {
  37431. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37432. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  37433. }
  37434. }
  37435. return $columns;
  37436. }
  37437. private function calculateColumnsWidth($rows)
  37438. {
  37439. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  37440. $lengths = array();
  37441. foreach ($rows as $row) {
  37442. if ($row instanceof TableSeparator) {
  37443. continue;
  37444. }
  37445. foreach ($row as $i => $cell) {
  37446. if ($cell instanceof TableCell) {
  37447. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  37448. $textLength = Helper::strlen($textContent);
  37449. if ($textLength > 0) {
  37450. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  37451. foreach ($contentColumns as $position => $content) {
  37452. $row[$i + $position] = $content;
  37453. }
  37454. }
  37455. }
  37456. }
  37457. $lengths[] = $this->getCellWidth($row, $column);
  37458. }
  37459. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  37460. }
  37461. }
  37462. private function getColumnSeparatorWidth()
  37463. {
  37464. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  37465. }
  37466. private function getCellWidth(array $row, $column)
  37467. {
  37468. if (isset($row[$column])) {
  37469. $cell = $row[$column];
  37470. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37471. return $cellWidth;
  37472. }
  37473. return 0;
  37474. }
  37475. private function cleanup()
  37476. {
  37477. $this->columnWidths = array();
  37478. $this->numberOfColumns = null;
  37479. }
  37480. private static function initStyles()
  37481. {
  37482. $borderless = new TableStyle();
  37483. $borderless
  37484. ->setHorizontalBorderChar('=')
  37485. ->setVerticalBorderChar(' ')
  37486. ->setCrossingChar(' ')
  37487. ;
  37488. $compact = new TableStyle();
  37489. $compact
  37490. ->setHorizontalBorderChar('')
  37491. ->setVerticalBorderChar(' ')
  37492. ->setCrossingChar('')
  37493. ->setCellRowContentFormat('%s')
  37494. ;
  37495. $styleGuide = new TableStyle();
  37496. $styleGuide
  37497. ->setHorizontalBorderChar('-')
  37498. ->setVerticalBorderChar(' ')
  37499. ->setCrossingChar(' ')
  37500. ->setCellHeaderFormat('%s')
  37501. ;
  37502. return array(
  37503. 'default' => new TableStyle(),
  37504. 'borderless' => $borderless,
  37505. 'compact' => $compact,
  37506. 'symfony-style-guide' => $styleGuide,
  37507. );
  37508. }
  37509. private function resolveStyle($name)
  37510. {
  37511. if ($name instanceof TableStyle) {
  37512. return $name;
  37513. }
  37514. if (isset(self::$styles[$name])) {
  37515. return self::$styles[$name];
  37516. }
  37517. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37518. }
  37519. }
  37520. <?php
  37521. namespace Symfony\Component\Console\Helper;
  37522. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37523. class TableCell
  37524. {
  37525. private $value;
  37526. private $options = array(
  37527. 'rowspan' => 1,
  37528. 'colspan' => 1,
  37529. );
  37530. public function __construct($value = '', array $options = array())
  37531. {
  37532. if (is_numeric($value) && !\is_string($value)) {
  37533. $value = (string) $value;
  37534. }
  37535. $this->value = $value;
  37536. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  37537. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  37538. }
  37539. $this->options = array_merge($this->options, $options);
  37540. }
  37541. public function __toString()
  37542. {
  37543. return $this->value;
  37544. }
  37545. public function getColspan()
  37546. {
  37547. return (int) $this->options['colspan'];
  37548. }
  37549. public function getRowspan()
  37550. {
  37551. return (int) $this->options['rowspan'];
  37552. }
  37553. }
  37554. <?php
  37555. namespace Symfony\Component\Console\Helper;
  37556. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37557. use Symfony\Component\Console\Output\NullOutput;
  37558. use Symfony\Component\Console\Output\OutputInterface;
  37559. class TableHelper extends Helper
  37560. {
  37561. const LAYOUT_DEFAULT = 0;
  37562. const LAYOUT_BORDERLESS = 1;
  37563. const LAYOUT_COMPACT = 2;
  37564. private $table;
  37565. public function __construct($triggerDeprecationError = true)
  37566. {
  37567. if ($triggerDeprecationError) {
  37568. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  37569. }
  37570. $this->table = new Table(new NullOutput());
  37571. }
  37572. public function setLayout($layout)
  37573. {
  37574. switch ($layout) {
  37575. case self::LAYOUT_BORDERLESS:
  37576. $this->table->setStyle('borderless');
  37577. break;
  37578. case self::LAYOUT_COMPACT:
  37579. $this->table->setStyle('compact');
  37580. break;
  37581. case self::LAYOUT_DEFAULT:
  37582. $this->table->setStyle('default');
  37583. break;
  37584. default:
  37585. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  37586. }
  37587. return $this;
  37588. }
  37589. public function setHeaders(array $headers)
  37590. {
  37591. $this->table->setHeaders($headers);
  37592. return $this;
  37593. }
  37594. public function setRows(array $rows)
  37595. {
  37596. $this->table->setRows($rows);
  37597. return $this;
  37598. }
  37599. public function addRows(array $rows)
  37600. {
  37601. $this->table->addRows($rows);
  37602. return $this;
  37603. }
  37604. public function addRow(array $row)
  37605. {
  37606. $this->table->addRow($row);
  37607. return $this;
  37608. }
  37609. public function setRow($column, array $row)
  37610. {
  37611. $this->table->setRow($column, $row);
  37612. return $this;
  37613. }
  37614. public function setPaddingChar($paddingChar)
  37615. {
  37616. $this->table->getStyle()->setPaddingChar($paddingChar);
  37617. return $this;
  37618. }
  37619. public function setHorizontalBorderChar($horizontalBorderChar)
  37620. {
  37621. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  37622. return $this;
  37623. }
  37624. public function setVerticalBorderChar($verticalBorderChar)
  37625. {
  37626. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  37627. return $this;
  37628. }
  37629. public function setCrossingChar($crossingChar)
  37630. {
  37631. $this->table->getStyle()->setCrossingChar($crossingChar);
  37632. return $this;
  37633. }
  37634. public function setCellHeaderFormat($cellHeaderFormat)
  37635. {
  37636. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  37637. return $this;
  37638. }
  37639. public function setCellRowFormat($cellRowFormat)
  37640. {
  37641. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  37642. return $this;
  37643. }
  37644. public function setCellRowContentFormat($cellRowContentFormat)
  37645. {
  37646. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  37647. return $this;
  37648. }
  37649. public function setBorderFormat($borderFormat)
  37650. {
  37651. $this->table->getStyle()->setBorderFormat($borderFormat);
  37652. return $this;
  37653. }
  37654. public function setPadType($padType)
  37655. {
  37656. $this->table->getStyle()->setPadType($padType);
  37657. return $this;
  37658. }
  37659. public function render(OutputInterface $output)
  37660. {
  37661. $p = new \ReflectionProperty($this->table, 'output');
  37662. $p->setAccessible(true);
  37663. $p->setValue($this->table, $output);
  37664. $this->table->render();
  37665. }
  37666. public function getName()
  37667. {
  37668. return 'table';
  37669. }
  37670. }
  37671. <?php
  37672. namespace Symfony\Component\Console\Helper;
  37673. class TableSeparator extends TableCell
  37674. {
  37675. public function __construct(array $options = array())
  37676. {
  37677. parent::__construct('', $options);
  37678. }
  37679. }
  37680. <?php
  37681. namespace Symfony\Component\Console\Helper;
  37682. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37683. use Symfony\Component\Console\Exception\LogicException;
  37684. class TableStyle
  37685. {
  37686. private $paddingChar = ' ';
  37687. private $horizontalBorderChar = '-';
  37688. private $verticalBorderChar = '|';
  37689. private $crossingChar = '+';
  37690. private $cellHeaderFormat = '<info>%s</info>';
  37691. private $cellRowFormat = '%s';
  37692. private $cellRowContentFormat = ' %s ';
  37693. private $borderFormat = '%s';
  37694. private $padType = STR_PAD_RIGHT;
  37695. public function setPaddingChar($paddingChar)
  37696. {
  37697. if (!$paddingChar) {
  37698. throw new LogicException('The padding char must not be empty');
  37699. }
  37700. $this->paddingChar = $paddingChar;
  37701. return $this;
  37702. }
  37703. public function getPaddingChar()
  37704. {
  37705. return $this->paddingChar;
  37706. }
  37707. public function setHorizontalBorderChar($horizontalBorderChar)
  37708. {
  37709. $this->horizontalBorderChar = $horizontalBorderChar;
  37710. return $this;
  37711. }
  37712. public function getHorizontalBorderChar()
  37713. {
  37714. return $this->horizontalBorderChar;
  37715. }
  37716. public function setVerticalBorderChar($verticalBorderChar)
  37717. {
  37718. $this->verticalBorderChar = $verticalBorderChar;
  37719. return $this;
  37720. }
  37721. public function getVerticalBorderChar()
  37722. {
  37723. return $this->verticalBorderChar;
  37724. }
  37725. public function setCrossingChar($crossingChar)
  37726. {
  37727. $this->crossingChar = $crossingChar;
  37728. return $this;
  37729. }
  37730. public function getCrossingChar()
  37731. {
  37732. return $this->crossingChar;
  37733. }
  37734. public function setCellHeaderFormat($cellHeaderFormat)
  37735. {
  37736. $this->cellHeaderFormat = $cellHeaderFormat;
  37737. return $this;
  37738. }
  37739. public function getCellHeaderFormat()
  37740. {
  37741. return $this->cellHeaderFormat;
  37742. }
  37743. public function setCellRowFormat($cellRowFormat)
  37744. {
  37745. $this->cellRowFormat = $cellRowFormat;
  37746. return $this;
  37747. }
  37748. public function getCellRowFormat()
  37749. {
  37750. return $this->cellRowFormat;
  37751. }
  37752. public function setCellRowContentFormat($cellRowContentFormat)
  37753. {
  37754. $this->cellRowContentFormat = $cellRowContentFormat;
  37755. return $this;
  37756. }
  37757. public function getCellRowContentFormat()
  37758. {
  37759. return $this->cellRowContentFormat;
  37760. }
  37761. public function setBorderFormat($borderFormat)
  37762. {
  37763. $this->borderFormat = $borderFormat;
  37764. return $this;
  37765. }
  37766. public function getBorderFormat()
  37767. {
  37768. return $this->borderFormat;
  37769. }
  37770. public function setPadType($padType)
  37771. {
  37772. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  37773. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  37774. }
  37775. $this->padType = $padType;
  37776. return $this;
  37777. }
  37778. public function getPadType()
  37779. {
  37780. return $this->padType;
  37781. }
  37782. }
  37783. <?php
  37784. namespace Symfony\Component\Console\Input;
  37785. use Symfony\Component\Console\Exception\RuntimeException;
  37786. class ArgvInput extends Input
  37787. {
  37788. private $tokens;
  37789. private $parsed;
  37790. public function __construct(array $argv = null, InputDefinition $definition = null)
  37791. {
  37792. if (null === $argv) {
  37793. $argv = $_SERVER['argv'];
  37794. }
  37795. array_shift($argv);
  37796. $this->tokens = $argv;
  37797. parent::__construct($definition);
  37798. }
  37799. protected function setTokens(array $tokens)
  37800. {
  37801. $this->tokens = $tokens;
  37802. }
  37803. protected function parse()
  37804. {
  37805. $parseOptions = true;
  37806. $this->parsed = $this->tokens;
  37807. while (null !== $token = array_shift($this->parsed)) {
  37808. if ($parseOptions && '' == $token) {
  37809. $this->parseArgument($token);
  37810. } elseif ($parseOptions && '--' == $token) {
  37811. $parseOptions = false;
  37812. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  37813. $this->parseLongOption($token);
  37814. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  37815. $this->parseShortOption($token);
  37816. } else {
  37817. $this->parseArgument($token);
  37818. }
  37819. }
  37820. }
  37821. private function parseShortOption($token)
  37822. {
  37823. $name = substr($token, 1);
  37824. if (\strlen($name) > 1) {
  37825. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  37826. $this->addShortOption($name[0], substr($name, 1));
  37827. } else {
  37828. $this->parseShortOptionSet($name);
  37829. }
  37830. } else {
  37831. $this->addShortOption($name, null);
  37832. }
  37833. }
  37834. private function parseShortOptionSet($name)
  37835. {
  37836. $len = \strlen($name);
  37837. for ($i = 0; $i < $len; ++$i) {
  37838. if (!$this->definition->hasShortcut($name[$i])) {
  37839. $encoding = mb_detect_encoding($name, null, true);
  37840. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  37841. }
  37842. $option = $this->definition->getOptionForShortcut($name[$i]);
  37843. if ($option->acceptValue()) {
  37844. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  37845. break;
  37846. } else {
  37847. $this->addLongOption($option->getName(), null);
  37848. }
  37849. }
  37850. }
  37851. private function parseLongOption($token)
  37852. {
  37853. $name = substr($token, 2);
  37854. if (false !== $pos = strpos($name, '=')) {
  37855. if (0 === \strlen($value = substr($name, $pos + 1))) {
  37856. array_unshift($this->parsed, null);
  37857. }
  37858. $this->addLongOption(substr($name, 0, $pos), $value);
  37859. } else {
  37860. $this->addLongOption($name, null);
  37861. }
  37862. }
  37863. private function parseArgument($token)
  37864. {
  37865. $c = \count($this->arguments);
  37866. if ($this->definition->hasArgument($c)) {
  37867. $arg = $this->definition->getArgument($c);
  37868. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  37869. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  37870. $arg = $this->definition->getArgument($c - 1);
  37871. $this->arguments[$arg->getName()][] = $token;
  37872. } else {
  37873. $all = $this->definition->getArguments();
  37874. if (\count($all)) {
  37875. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  37876. }
  37877. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  37878. }
  37879. }
  37880. private function addShortOption($shortcut, $value)
  37881. {
  37882. if (!$this->definition->hasShortcut($shortcut)) {
  37883. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  37884. }
  37885. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  37886. }
  37887. private function addLongOption($name, $value)
  37888. {
  37889. if (!$this->definition->hasOption($name)) {
  37890. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  37891. }
  37892. $option = $this->definition->getOption($name);
  37893. if (!isset($value[0])) {
  37894. $value = null;
  37895. }
  37896. if (null !== $value && !$option->acceptValue()) {
  37897. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  37898. }
  37899. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  37900. $next = array_shift($this->parsed);
  37901. if (isset($next[0]) && '-' !== $next[0]) {
  37902. $value = $next;
  37903. } elseif (empty($next)) {
  37904. $value = null;
  37905. } else {
  37906. array_unshift($this->parsed, $next);
  37907. }
  37908. }
  37909. if (null === $value) {
  37910. if ($option->isValueRequired()) {
  37911. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  37912. }
  37913. if (!$option->isArray()) {
  37914. $value = $option->isValueOptional() ? $option->getDefault() : true;
  37915. }
  37916. }
  37917. if ($option->isArray()) {
  37918. $this->options[$name][] = $value;
  37919. } else {
  37920. $this->options[$name] = $value;
  37921. }
  37922. }
  37923. public function getFirstArgument()
  37924. {
  37925. foreach ($this->tokens as $token) {
  37926. if ($token && '-' === $token[0]) {
  37927. continue;
  37928. }
  37929. return $token;
  37930. }
  37931. }
  37932. public function hasParameterOption($values)
  37933. {
  37934. $values = (array) $values;
  37935. foreach ($this->tokens as $token) {
  37936. foreach ($values as $value) {
  37937. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37938. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  37939. return true;
  37940. }
  37941. }
  37942. }
  37943. return false;
  37944. }
  37945. public function getParameterOption($values, $default = false)
  37946. {
  37947. $values = (array) $values;
  37948. $tokens = $this->tokens;
  37949. while (0 < \count($tokens)) {
  37950. $token = array_shift($tokens);
  37951. foreach ($values as $value) {
  37952. if ($token === $value) {
  37953. return array_shift($tokens);
  37954. }
  37955. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37956. if ('' !== $leading && 0 === strpos($token, $leading)) {
  37957. return substr($token, \strlen($leading));
  37958. }
  37959. }
  37960. }
  37961. return $default;
  37962. }
  37963. public function __toString()
  37964. {
  37965. $self = $this;
  37966. $tokens = array_map(function ($token) use ($self) {
  37967. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  37968. return $match[1].$self->escapeToken($match[2]);
  37969. }
  37970. if ($token && '-' !== $token[0]) {
  37971. return $self->escapeToken($token);
  37972. }
  37973. return $token;
  37974. }, $this->tokens);
  37975. return implode(' ', $tokens);
  37976. }
  37977. }
  37978. <?php
  37979. namespace Symfony\Component\Console\Input;
  37980. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37981. use Symfony\Component\Console\Exception\InvalidOptionException;
  37982. class ArrayInput extends Input
  37983. {
  37984. private $parameters;
  37985. public function __construct(array $parameters, InputDefinition $definition = null)
  37986. {
  37987. $this->parameters = $parameters;
  37988. parent::__construct($definition);
  37989. }
  37990. public function getFirstArgument()
  37991. {
  37992. foreach ($this->parameters as $key => $value) {
  37993. if ($key && '-' === $key[0]) {
  37994. continue;
  37995. }
  37996. return $value;
  37997. }
  37998. }
  37999. public function hasParameterOption($values)
  38000. {
  38001. $values = (array) $values;
  38002. foreach ($this->parameters as $k => $v) {
  38003. if (!\is_int($k)) {
  38004. $v = $k;
  38005. }
  38006. if (\in_array($v, $values)) {
  38007. return true;
  38008. }
  38009. }
  38010. return false;
  38011. }
  38012. public function getParameterOption($values, $default = false)
  38013. {
  38014. $values = (array) $values;
  38015. foreach ($this->parameters as $k => $v) {
  38016. if (\is_int($k)) {
  38017. if (\in_array($v, $values)) {
  38018. return true;
  38019. }
  38020. } elseif (\in_array($k, $values)) {
  38021. return $v;
  38022. }
  38023. }
  38024. return $default;
  38025. }
  38026. public function __toString()
  38027. {
  38028. $params = array();
  38029. foreach ($this->parameters as $param => $val) {
  38030. if ($param && '-' === $param[0]) {
  38031. if (\is_array($val)) {
  38032. foreach ($val as $v) {
  38033. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  38034. }
  38035. } else {
  38036. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  38037. }
  38038. } else {
  38039. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  38040. }
  38041. }
  38042. return implode(' ', $params);
  38043. }
  38044. protected function parse()
  38045. {
  38046. foreach ($this->parameters as $key => $value) {
  38047. if (0 === strpos($key, '--')) {
  38048. $this->addLongOption(substr($key, 2), $value);
  38049. } elseif ('-' === $key[0]) {
  38050. $this->addShortOption(substr($key, 1), $value);
  38051. } else {
  38052. $this->addArgument($key, $value);
  38053. }
  38054. }
  38055. }
  38056. private function addShortOption($shortcut, $value)
  38057. {
  38058. if (!$this->definition->hasShortcut($shortcut)) {
  38059. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  38060. }
  38061. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  38062. }
  38063. private function addLongOption($name, $value)
  38064. {
  38065. if (!$this->definition->hasOption($name)) {
  38066. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  38067. }
  38068. $option = $this->definition->getOption($name);
  38069. if (null === $value) {
  38070. if ($option->isValueRequired()) {
  38071. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  38072. }
  38073. $value = $option->isValueOptional() ? $option->getDefault() : true;
  38074. }
  38075. $this->options[$name] = $value;
  38076. }
  38077. private function addArgument($name, $value)
  38078. {
  38079. if (!$this->definition->hasArgument($name)) {
  38080. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38081. }
  38082. $this->arguments[$name] = $value;
  38083. }
  38084. }
  38085. <?php
  38086. namespace Symfony\Component\Console\Input;
  38087. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38088. use Symfony\Component\Console\Exception\RuntimeException;
  38089. abstract class Input implements InputInterface
  38090. {
  38091. protected $definition;
  38092. protected $options = array();
  38093. protected $arguments = array();
  38094. protected $interactive = true;
  38095. public function __construct(InputDefinition $definition = null)
  38096. {
  38097. if (null === $definition) {
  38098. $this->definition = new InputDefinition();
  38099. } else {
  38100. $this->bind($definition);
  38101. $this->validate();
  38102. }
  38103. }
  38104. public function bind(InputDefinition $definition)
  38105. {
  38106. $this->arguments = array();
  38107. $this->options = array();
  38108. $this->definition = $definition;
  38109. $this->parse();
  38110. }
  38111. abstract protected function parse();
  38112. public function validate()
  38113. {
  38114. $definition = $this->definition;
  38115. $givenArguments = $this->arguments;
  38116. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  38117. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  38118. });
  38119. if (\count($missingArguments) > 0) {
  38120. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  38121. }
  38122. }
  38123. public function isInteractive()
  38124. {
  38125. return $this->interactive;
  38126. }
  38127. public function setInteractive($interactive)
  38128. {
  38129. $this->interactive = (bool) $interactive;
  38130. }
  38131. public function getArguments()
  38132. {
  38133. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  38134. }
  38135. public function getArgument($name)
  38136. {
  38137. if (!$this->definition->hasArgument($name)) {
  38138. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38139. }
  38140. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  38141. }
  38142. public function setArgument($name, $value)
  38143. {
  38144. if (!$this->definition->hasArgument($name)) {
  38145. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38146. }
  38147. $this->arguments[$name] = $value;
  38148. }
  38149. public function hasArgument($name)
  38150. {
  38151. return $this->definition->hasArgument($name);
  38152. }
  38153. public function getOptions()
  38154. {
  38155. return array_merge($this->definition->getOptionDefaults(), $this->options);
  38156. }
  38157. public function getOption($name)
  38158. {
  38159. if (!$this->definition->hasOption($name)) {
  38160. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38161. }
  38162. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  38163. }
  38164. public function setOption($name, $value)
  38165. {
  38166. if (!$this->definition->hasOption($name)) {
  38167. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38168. }
  38169. $this->options[$name] = $value;
  38170. }
  38171. public function hasOption($name)
  38172. {
  38173. return $this->definition->hasOption($name);
  38174. }
  38175. public function escapeToken($token)
  38176. {
  38177. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  38178. }
  38179. }
  38180. <?php
  38181. namespace Symfony\Component\Console\Input;
  38182. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38183. use Symfony\Component\Console\Exception\LogicException;
  38184. class InputArgument
  38185. {
  38186. const REQUIRED = 1;
  38187. const OPTIONAL = 2;
  38188. const IS_ARRAY = 4;
  38189. private $name;
  38190. private $mode;
  38191. private $default;
  38192. private $description;
  38193. public function __construct($name, $mode = null, $description = '', $default = null)
  38194. {
  38195. if (null === $mode) {
  38196. $mode = self::OPTIONAL;
  38197. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  38198. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  38199. }
  38200. $this->name = $name;
  38201. $this->mode = $mode;
  38202. $this->description = $description;
  38203. $this->setDefault($default);
  38204. }
  38205. public function getName()
  38206. {
  38207. return $this->name;
  38208. }
  38209. public function isRequired()
  38210. {
  38211. return self::REQUIRED === (self::REQUIRED & $this->mode);
  38212. }
  38213. public function isArray()
  38214. {
  38215. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  38216. }
  38217. public function setDefault($default = null)
  38218. {
  38219. if (self::REQUIRED === $this->mode && null !== $default) {
  38220. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  38221. }
  38222. if ($this->isArray()) {
  38223. if (null === $default) {
  38224. $default = array();
  38225. } elseif (!\is_array($default)) {
  38226. throw new LogicException('A default value for an array argument must be an array.');
  38227. }
  38228. }
  38229. $this->default = $default;
  38230. }
  38231. public function getDefault()
  38232. {
  38233. return $this->default;
  38234. }
  38235. public function getDescription()
  38236. {
  38237. return $this->description;
  38238. }
  38239. }
  38240. <?php
  38241. namespace Symfony\Component\Console\Input;
  38242. interface InputAwareInterface
  38243. {
  38244. public function setInput(InputInterface $input);
  38245. }
  38246. <?php
  38247. namespace Symfony\Component\Console\Input;
  38248. use Symfony\Component\Console\Descriptor\TextDescriptor;
  38249. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  38250. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38251. use Symfony\Component\Console\Exception\LogicException;
  38252. use Symfony\Component\Console\Output\BufferedOutput;
  38253. class InputDefinition
  38254. {
  38255. private $arguments;
  38256. private $requiredCount;
  38257. private $hasAnArrayArgument = false;
  38258. private $hasOptional;
  38259. private $options;
  38260. private $shortcuts;
  38261. public function __construct(array $definition = array())
  38262. {
  38263. $this->setDefinition($definition);
  38264. }
  38265. public function setDefinition(array $definition)
  38266. {
  38267. $arguments = array();
  38268. $options = array();
  38269. foreach ($definition as $item) {
  38270. if ($item instanceof InputOption) {
  38271. $options[] = $item;
  38272. } else {
  38273. $arguments[] = $item;
  38274. }
  38275. }
  38276. $this->setArguments($arguments);
  38277. $this->setOptions($options);
  38278. }
  38279. public function setArguments($arguments = array())
  38280. {
  38281. $this->arguments = array();
  38282. $this->requiredCount = 0;
  38283. $this->hasOptional = false;
  38284. $this->hasAnArrayArgument = false;
  38285. $this->addArguments($arguments);
  38286. }
  38287. public function addArguments($arguments = array())
  38288. {
  38289. if (null !== $arguments) {
  38290. foreach ($arguments as $argument) {
  38291. $this->addArgument($argument);
  38292. }
  38293. }
  38294. }
  38295. public function addArgument(InputArgument $argument)
  38296. {
  38297. if (isset($this->arguments[$argument->getName()])) {
  38298. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  38299. }
  38300. if ($this->hasAnArrayArgument) {
  38301. throw new LogicException('Cannot add an argument after an array argument.');
  38302. }
  38303. if ($argument->isRequired() && $this->hasOptional) {
  38304. throw new LogicException('Cannot add a required argument after an optional one.');
  38305. }
  38306. if ($argument->isArray()) {
  38307. $this->hasAnArrayArgument = true;
  38308. }
  38309. if ($argument->isRequired()) {
  38310. ++$this->requiredCount;
  38311. } else {
  38312. $this->hasOptional = true;
  38313. }
  38314. $this->arguments[$argument->getName()] = $argument;
  38315. }
  38316. public function getArgument($name)
  38317. {
  38318. if (!$this->hasArgument($name)) {
  38319. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38320. }
  38321. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38322. return $arguments[$name];
  38323. }
  38324. public function hasArgument($name)
  38325. {
  38326. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38327. return isset($arguments[$name]);
  38328. }
  38329. public function getArguments()
  38330. {
  38331. return $this->arguments;
  38332. }
  38333. public function getArgumentCount()
  38334. {
  38335. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  38336. }
  38337. public function getArgumentRequiredCount()
  38338. {
  38339. return $this->requiredCount;
  38340. }
  38341. public function getArgumentDefaults()
  38342. {
  38343. $values = array();
  38344. foreach ($this->arguments as $argument) {
  38345. $values[$argument->getName()] = $argument->getDefault();
  38346. }
  38347. return $values;
  38348. }
  38349. public function setOptions($options = array())
  38350. {
  38351. $this->options = array();
  38352. $this->shortcuts = array();
  38353. $this->addOptions($options);
  38354. }
  38355. public function addOptions($options = array())
  38356. {
  38357. foreach ($options as $option) {
  38358. $this->addOption($option);
  38359. }
  38360. }
  38361. public function addOption(InputOption $option)
  38362. {
  38363. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  38364. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  38365. }
  38366. if ($option->getShortcut()) {
  38367. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38368. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  38369. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  38370. }
  38371. }
  38372. }
  38373. $this->options[$option->getName()] = $option;
  38374. if ($option->getShortcut()) {
  38375. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38376. $this->shortcuts[$shortcut] = $option->getName();
  38377. }
  38378. }
  38379. }
  38380. public function getOption($name)
  38381. {
  38382. if (!$this->hasOption($name)) {
  38383. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  38384. }
  38385. return $this->options[$name];
  38386. }
  38387. public function hasOption($name)
  38388. {
  38389. return isset($this->options[$name]);
  38390. }
  38391. public function getOptions()
  38392. {
  38393. return $this->options;
  38394. }
  38395. public function hasShortcut($name)
  38396. {
  38397. return isset($this->shortcuts[$name]);
  38398. }
  38399. public function getOptionForShortcut($shortcut)
  38400. {
  38401. return $this->getOption($this->shortcutToName($shortcut));
  38402. }
  38403. public function getOptionDefaults()
  38404. {
  38405. $values = array();
  38406. foreach ($this->options as $option) {
  38407. $values[$option->getName()] = $option->getDefault();
  38408. }
  38409. return $values;
  38410. }
  38411. private function shortcutToName($shortcut)
  38412. {
  38413. if (!isset($this->shortcuts[$shortcut])) {
  38414. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  38415. }
  38416. return $this->shortcuts[$shortcut];
  38417. }
  38418. public function getSynopsis($short = false)
  38419. {
  38420. $elements = array();
  38421. if ($short && $this->getOptions()) {
  38422. $elements[] = '[options]';
  38423. } elseif (!$short) {
  38424. foreach ($this->getOptions() as $option) {
  38425. $value = '';
  38426. if ($option->acceptValue()) {
  38427. $value = sprintf(
  38428. ' %s%s%s',
  38429. $option->isValueOptional() ? '[' : '',
  38430. strtoupper($option->getName()),
  38431. $option->isValueOptional() ? ']' : ''
  38432. );
  38433. }
  38434. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  38435. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  38436. }
  38437. }
  38438. if (\count($elements) && $this->getArguments()) {
  38439. $elements[] = '[--]';
  38440. }
  38441. foreach ($this->getArguments() as $argument) {
  38442. $element = '<'.$argument->getName().'>';
  38443. if (!$argument->isRequired()) {
  38444. $element = '['.$element.']';
  38445. } elseif ($argument->isArray()) {
  38446. $element .= ' ('.$element.')';
  38447. }
  38448. if ($argument->isArray()) {
  38449. $element .= '...';
  38450. }
  38451. $elements[] = $element;
  38452. }
  38453. return implode(' ', $elements);
  38454. }
  38455. public function asText()
  38456. {
  38457. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38458. $descriptor = new TextDescriptor();
  38459. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  38460. $descriptor->describe($output, $this, array('raw_output' => true));
  38461. return $output->fetch();
  38462. }
  38463. public function asXml($asDom = false)
  38464. {
  38465. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38466. $descriptor = new XmlDescriptor();
  38467. if ($asDom) {
  38468. return $descriptor->getInputDefinitionDocument($this);
  38469. }
  38470. $output = new BufferedOutput();
  38471. $descriptor->describe($output, $this);
  38472. return $output->fetch();
  38473. }
  38474. }
  38475. <?php
  38476. namespace Symfony\Component\Console\Input;
  38477. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38478. use Symfony\Component\Console\Exception\RuntimeException;
  38479. interface InputInterface
  38480. {
  38481. public function getFirstArgument();
  38482. public function hasParameterOption($values);
  38483. public function getParameterOption($values, $default = false);
  38484. public function bind(InputDefinition $definition);
  38485. public function validate();
  38486. public function getArguments();
  38487. public function getArgument($name);
  38488. public function setArgument($name, $value);
  38489. public function hasArgument($name);
  38490. public function getOptions();
  38491. public function getOption($name);
  38492. public function setOption($name, $value);
  38493. public function hasOption($name);
  38494. public function isInteractive();
  38495. public function setInteractive($interactive);
  38496. }
  38497. <?php
  38498. namespace Symfony\Component\Console\Input;
  38499. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38500. use Symfony\Component\Console\Exception\LogicException;
  38501. class InputOption
  38502. {
  38503. const VALUE_NONE = 1;
  38504. const VALUE_REQUIRED = 2;
  38505. const VALUE_OPTIONAL = 4;
  38506. const VALUE_IS_ARRAY = 8;
  38507. private $name;
  38508. private $shortcut;
  38509. private $mode;
  38510. private $default;
  38511. private $description;
  38512. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  38513. {
  38514. if (0 === strpos($name, '--')) {
  38515. $name = substr($name, 2);
  38516. }
  38517. if (empty($name)) {
  38518. throw new InvalidArgumentException('An option name cannot be empty.');
  38519. }
  38520. if (empty($shortcut)) {
  38521. $shortcut = null;
  38522. }
  38523. if (null !== $shortcut) {
  38524. if (\is_array($shortcut)) {
  38525. $shortcut = implode('|', $shortcut);
  38526. }
  38527. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  38528. $shortcuts = array_filter($shortcuts);
  38529. $shortcut = implode('|', $shortcuts);
  38530. if (empty($shortcut)) {
  38531. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  38532. }
  38533. }
  38534. if (null === $mode) {
  38535. $mode = self::VALUE_NONE;
  38536. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  38537. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  38538. }
  38539. $this->name = $name;
  38540. $this->shortcut = $shortcut;
  38541. $this->mode = $mode;
  38542. $this->description = $description;
  38543. if ($this->isArray() && !$this->acceptValue()) {
  38544. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  38545. }
  38546. $this->setDefault($default);
  38547. }
  38548. public function getShortcut()
  38549. {
  38550. return $this->shortcut;
  38551. }
  38552. public function getName()
  38553. {
  38554. return $this->name;
  38555. }
  38556. public function acceptValue()
  38557. {
  38558. return $this->isValueRequired() || $this->isValueOptional();
  38559. }
  38560. public function isValueRequired()
  38561. {
  38562. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  38563. }
  38564. public function isValueOptional()
  38565. {
  38566. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  38567. }
  38568. public function isArray()
  38569. {
  38570. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  38571. }
  38572. public function setDefault($default = null)
  38573. {
  38574. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  38575. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  38576. }
  38577. if ($this->isArray()) {
  38578. if (null === $default) {
  38579. $default = array();
  38580. } elseif (!\is_array($default)) {
  38581. throw new LogicException('A default value for an array option must be an array.');
  38582. }
  38583. }
  38584. $this->default = $this->acceptValue() ? $default : false;
  38585. }
  38586. public function getDefault()
  38587. {
  38588. return $this->default;
  38589. }
  38590. public function getDescription()
  38591. {
  38592. return $this->description;
  38593. }
  38594. public function equals(self $option)
  38595. {
  38596. return $option->getName() === $this->getName()
  38597. && $option->getShortcut() === $this->getShortcut()
  38598. && $option->getDefault() === $this->getDefault()
  38599. && $option->isArray() === $this->isArray()
  38600. && $option->isValueRequired() === $this->isValueRequired()
  38601. && $option->isValueOptional() === $this->isValueOptional()
  38602. ;
  38603. }
  38604. }
  38605. <?php
  38606. namespace Symfony\Component\Console\Input;
  38607. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38608. class StringInput extends ArgvInput
  38609. {
  38610. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  38611. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  38612. public function __construct($input, InputDefinition $definition = null)
  38613. {
  38614. if ($definition) {
  38615. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  38616. }
  38617. parent::__construct(array(), null);
  38618. $this->setTokens($this->tokenize($input));
  38619. if (null !== $definition) {
  38620. $this->bind($definition);
  38621. }
  38622. }
  38623. private function tokenize($input)
  38624. {
  38625. $tokens = array();
  38626. $length = \strlen($input);
  38627. $cursor = 0;
  38628. while ($cursor < $length) {
  38629. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  38630. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  38631. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  38632. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  38633. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  38634. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  38635. $tokens[] = stripcslashes($match[1]);
  38636. } else {
  38637. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  38638. }
  38639. $cursor += \strlen($match[0]);
  38640. }
  38641. return $tokens;
  38642. }
  38643. }
  38644. Copyright (c) 2004-2018 Fabien Potencier
  38645. Permission is hereby granted, free of charge, to any person obtaining a copy
  38646. of this software and associated documentation files (the "Software"), to deal
  38647. in the Software without restriction, including without limitation the rights
  38648. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38649. copies of the Software, and to permit persons to whom the Software is furnished
  38650. to do so, subject to the following conditions:
  38651. The above copyright notice and this permission notice shall be included in all
  38652. copies or substantial portions of the Software.
  38653. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38654. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38655. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38656. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38657. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38658. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38659. THE SOFTWARE.
  38660. <?php
  38661. namespace Symfony\Component\Console\Logger;
  38662. use Psr\Log\AbstractLogger;
  38663. use Psr\Log\InvalidArgumentException;
  38664. use Psr\Log\LogLevel;
  38665. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  38666. use Symfony\Component\Console\Output\OutputInterface;
  38667. class ConsoleLogger extends AbstractLogger
  38668. {
  38669. const INFO = 'info';
  38670. const ERROR = 'error';
  38671. private $output;
  38672. private $verbosityLevelMap = array(
  38673. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  38674. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  38675. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  38676. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  38677. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  38678. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  38679. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  38680. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  38681. );
  38682. private $formatLevelMap = array(
  38683. LogLevel::EMERGENCY => self::ERROR,
  38684. LogLevel::ALERT => self::ERROR,
  38685. LogLevel::CRITICAL => self::ERROR,
  38686. LogLevel::ERROR => self::ERROR,
  38687. LogLevel::WARNING => self::INFO,
  38688. LogLevel::NOTICE => self::INFO,
  38689. LogLevel::INFO => self::INFO,
  38690. LogLevel::DEBUG => self::INFO,
  38691. );
  38692. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  38693. {
  38694. $this->output = $output;
  38695. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  38696. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  38697. }
  38698. public function log($level, $message, array $context = array())
  38699. {
  38700. if (!isset($this->verbosityLevelMap[$level])) {
  38701. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  38702. }
  38703. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  38704. $output = $this->output->getErrorOutput();
  38705. } else {
  38706. $output = $this->output;
  38707. }
  38708. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  38709. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  38710. }
  38711. }
  38712. private function interpolate($message, array $context)
  38713. {
  38714. $replace = array();
  38715. foreach ($context as $key => $val) {
  38716. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  38717. $replace[sprintf('{%s}', $key)] = $val;
  38718. }
  38719. }
  38720. return strtr($message, $replace);
  38721. }
  38722. }
  38723. <?php
  38724. namespace Symfony\Component\Console\Output;
  38725. class BufferedOutput extends Output
  38726. {
  38727. private $buffer = '';
  38728. public function fetch()
  38729. {
  38730. $content = $this->buffer;
  38731. $this->buffer = '';
  38732. return $content;
  38733. }
  38734. protected function doWrite($message, $newline)
  38735. {
  38736. $this->buffer .= $message;
  38737. if ($newline) {
  38738. $this->buffer .= PHP_EOL;
  38739. }
  38740. }
  38741. }
  38742. <?php
  38743. namespace Symfony\Component\Console\Output;
  38744. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38745. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  38746. {
  38747. private $stderr;
  38748. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38749. {
  38750. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  38751. $actualDecorated = $this->isDecorated();
  38752. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  38753. if (null === $decorated) {
  38754. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  38755. }
  38756. }
  38757. public function setDecorated($decorated)
  38758. {
  38759. parent::setDecorated($decorated);
  38760. $this->stderr->setDecorated($decorated);
  38761. }
  38762. public function setFormatter(OutputFormatterInterface $formatter)
  38763. {
  38764. parent::setFormatter($formatter);
  38765. $this->stderr->setFormatter($formatter);
  38766. }
  38767. public function setVerbosity($level)
  38768. {
  38769. parent::setVerbosity($level);
  38770. $this->stderr->setVerbosity($level);
  38771. }
  38772. public function getErrorOutput()
  38773. {
  38774. return $this->stderr;
  38775. }
  38776. public function setErrorOutput(OutputInterface $error)
  38777. {
  38778. $this->stderr = $error;
  38779. }
  38780. protected function hasStdoutSupport()
  38781. {
  38782. return false === $this->isRunningOS400();
  38783. }
  38784. protected function hasStderrSupport()
  38785. {
  38786. return false === $this->isRunningOS400();
  38787. }
  38788. private function isRunningOS400()
  38789. {
  38790. $checks = array(
  38791. \function_exists('php_uname') ? php_uname('s') : '',
  38792. getenv('OSTYPE'),
  38793. PHP_OS,
  38794. );
  38795. return false !== stripos(implode(';', $checks), 'OS400');
  38796. }
  38797. private function openOutputStream()
  38798. {
  38799. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  38800. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  38801. }
  38802. private function openErrorStream()
  38803. {
  38804. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  38805. return fopen($errorStream, 'w');
  38806. }
  38807. }
  38808. <?php
  38809. namespace Symfony\Component\Console\Output;
  38810. interface ConsoleOutputInterface extends OutputInterface
  38811. {
  38812. public function getErrorOutput();
  38813. public function setErrorOutput(OutputInterface $error);
  38814. }
  38815. <?php
  38816. namespace Symfony\Component\Console\Output;
  38817. use Symfony\Component\Console\Formatter\OutputFormatter;
  38818. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38819. class NullOutput implements OutputInterface
  38820. {
  38821. public function setFormatter(OutputFormatterInterface $formatter)
  38822. {
  38823. }
  38824. public function getFormatter()
  38825. {
  38826. return new OutputFormatter();
  38827. }
  38828. public function setDecorated($decorated)
  38829. {
  38830. }
  38831. public function isDecorated()
  38832. {
  38833. return false;
  38834. }
  38835. public function setVerbosity($level)
  38836. {
  38837. }
  38838. public function getVerbosity()
  38839. {
  38840. return self::VERBOSITY_QUIET;
  38841. }
  38842. public function isQuiet()
  38843. {
  38844. return true;
  38845. }
  38846. public function isVerbose()
  38847. {
  38848. return false;
  38849. }
  38850. public function isVeryVerbose()
  38851. {
  38852. return false;
  38853. }
  38854. public function isDebug()
  38855. {
  38856. return false;
  38857. }
  38858. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38859. {
  38860. }
  38861. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38862. {
  38863. }
  38864. }
  38865. <?php
  38866. namespace Symfony\Component\Console\Output;
  38867. use Symfony\Component\Console\Formatter\OutputFormatter;
  38868. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38869. abstract class Output implements OutputInterface
  38870. {
  38871. private $verbosity;
  38872. private $formatter;
  38873. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  38874. {
  38875. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  38876. $this->formatter = $formatter ?: new OutputFormatter();
  38877. $this->formatter->setDecorated($decorated);
  38878. }
  38879. public function setFormatter(OutputFormatterInterface $formatter)
  38880. {
  38881. $this->formatter = $formatter;
  38882. }
  38883. public function getFormatter()
  38884. {
  38885. return $this->formatter;
  38886. }
  38887. public function setDecorated($decorated)
  38888. {
  38889. $this->formatter->setDecorated($decorated);
  38890. }
  38891. public function isDecorated()
  38892. {
  38893. return $this->formatter->isDecorated();
  38894. }
  38895. public function setVerbosity($level)
  38896. {
  38897. $this->verbosity = (int) $level;
  38898. }
  38899. public function getVerbosity()
  38900. {
  38901. return $this->verbosity;
  38902. }
  38903. public function isQuiet()
  38904. {
  38905. return self::VERBOSITY_QUIET === $this->verbosity;
  38906. }
  38907. public function isVerbose()
  38908. {
  38909. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  38910. }
  38911. public function isVeryVerbose()
  38912. {
  38913. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  38914. }
  38915. public function isDebug()
  38916. {
  38917. return self::VERBOSITY_DEBUG <= $this->verbosity;
  38918. }
  38919. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38920. {
  38921. $this->write($messages, true, $options);
  38922. }
  38923. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38924. {
  38925. $messages = (array) $messages;
  38926. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  38927. $type = $types & $options ?: self::OUTPUT_NORMAL;
  38928. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  38929. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  38930. if ($verbosity > $this->getVerbosity()) {
  38931. return;
  38932. }
  38933. foreach ($messages as $message) {
  38934. switch ($type) {
  38935. case OutputInterface::OUTPUT_NORMAL:
  38936. $message = $this->formatter->format($message);
  38937. break;
  38938. case OutputInterface::OUTPUT_RAW:
  38939. break;
  38940. case OutputInterface::OUTPUT_PLAIN:
  38941. $message = strip_tags($this->formatter->format($message));
  38942. break;
  38943. }
  38944. $this->doWrite($message, $newline);
  38945. }
  38946. }
  38947. abstract protected function doWrite($message, $newline);
  38948. }
  38949. <?php
  38950. namespace Symfony\Component\Console\Output;
  38951. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38952. interface OutputInterface
  38953. {
  38954. const VERBOSITY_QUIET = 16;
  38955. const VERBOSITY_NORMAL = 32;
  38956. const VERBOSITY_VERBOSE = 64;
  38957. const VERBOSITY_VERY_VERBOSE = 128;
  38958. const VERBOSITY_DEBUG = 256;
  38959. const OUTPUT_NORMAL = 1;
  38960. const OUTPUT_RAW = 2;
  38961. const OUTPUT_PLAIN = 4;
  38962. public function write($messages, $newline = false, $options = 0);
  38963. public function writeln($messages, $options = 0);
  38964. public function setVerbosity($level);
  38965. public function getVerbosity();
  38966. public function setDecorated($decorated);
  38967. public function isDecorated();
  38968. public function setFormatter(OutputFormatterInterface $formatter);
  38969. public function getFormatter();
  38970. }
  38971. <?php
  38972. namespace Symfony\Component\Console\Output;
  38973. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38974. use Symfony\Component\Console\Exception\RuntimeException;
  38975. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38976. class StreamOutput extends Output
  38977. {
  38978. private $stream;
  38979. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38980. {
  38981. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  38982. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  38983. }
  38984. $this->stream = $stream;
  38985. if (null === $decorated) {
  38986. $decorated = $this->hasColorSupport();
  38987. }
  38988. parent::__construct($verbosity, $decorated, $formatter);
  38989. }
  38990. public function getStream()
  38991. {
  38992. return $this->stream;
  38993. }
  38994. protected function doWrite($message, $newline)
  38995. {
  38996. if ($newline) {
  38997. $message .= PHP_EOL;
  38998. }
  38999. if (false === @fwrite($this->stream, $message)) {
  39000. throw new RuntimeException('Unable to write output.');
  39001. }
  39002. fflush($this->stream);
  39003. }
  39004. protected function hasColorSupport()
  39005. {
  39006. if ('Hyper' === getenv('TERM_PROGRAM')) {
  39007. return true;
  39008. }
  39009. if (\DIRECTORY_SEPARATOR === '\\') {
  39010. return (\function_exists('sapi_windows_vt100_support')
  39011. && @sapi_windows_vt100_support($this->stream))
  39012. || false !== getenv('ANSICON')
  39013. || 'ON' === getenv('ConEmuANSI')
  39014. || 'xterm' === getenv('TERM');
  39015. }
  39016. if (\function_exists('stream_isatty')) {
  39017. return @stream_isatty($this->stream);
  39018. }
  39019. if (\function_exists('posix_isatty')) {
  39020. return @posix_isatty($this->stream);
  39021. }
  39022. $stat = @fstat($this->stream);
  39023. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  39024. }
  39025. }
  39026. <?php
  39027. namespace Symfony\Component\Console\Question;
  39028. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39029. class ChoiceQuestion extends Question
  39030. {
  39031. private $choices;
  39032. private $multiselect = false;
  39033. private $prompt = ' > ';
  39034. private $errorMessage = 'Value "%s" is invalid';
  39035. public function __construct($question, array $choices, $default = null)
  39036. {
  39037. if (!$choices) {
  39038. throw new \LogicException('Choice question must have at least 1 choice available.');
  39039. }
  39040. parent::__construct($question, $default);
  39041. $this->choices = $choices;
  39042. $this->setValidator($this->getDefaultValidator());
  39043. $this->setAutocompleterValues($choices);
  39044. }
  39045. public function getChoices()
  39046. {
  39047. return $this->choices;
  39048. }
  39049. public function setMultiselect($multiselect)
  39050. {
  39051. $this->multiselect = $multiselect;
  39052. $this->setValidator($this->getDefaultValidator());
  39053. return $this;
  39054. }
  39055. public function isMultiselect()
  39056. {
  39057. return $this->multiselect;
  39058. }
  39059. public function getPrompt()
  39060. {
  39061. return $this->prompt;
  39062. }
  39063. public function setPrompt($prompt)
  39064. {
  39065. $this->prompt = $prompt;
  39066. return $this;
  39067. }
  39068. public function setErrorMessage($errorMessage)
  39069. {
  39070. $this->errorMessage = $errorMessage;
  39071. $this->setValidator($this->getDefaultValidator());
  39072. return $this;
  39073. }
  39074. private function getDefaultValidator()
  39075. {
  39076. $choices = $this->choices;
  39077. $errorMessage = $this->errorMessage;
  39078. $multiselect = $this->multiselect;
  39079. $isAssoc = $this->isAssoc($choices);
  39080. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  39081. $selectedChoices = str_replace(' ', '', $selected);
  39082. if ($multiselect) {
  39083. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  39084. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  39085. }
  39086. $selectedChoices = explode(',', $selectedChoices);
  39087. } else {
  39088. $selectedChoices = array($selected);
  39089. }
  39090. $multiselectChoices = array();
  39091. foreach ($selectedChoices as $value) {
  39092. $results = array();
  39093. foreach ($choices as $key => $choice) {
  39094. if ($choice === $value) {
  39095. $results[] = $key;
  39096. }
  39097. }
  39098. if (\count($results) > 1) {
  39099. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  39100. }
  39101. $result = array_search($value, $choices);
  39102. if (!$isAssoc) {
  39103. if (false !== $result) {
  39104. $result = $choices[$result];
  39105. } elseif (isset($choices[$value])) {
  39106. $result = $choices[$value];
  39107. }
  39108. } elseif (false === $result && isset($choices[$value])) {
  39109. $result = $value;
  39110. }
  39111. if (false === $result) {
  39112. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  39113. }
  39114. $multiselectChoices[] = (string) $result;
  39115. }
  39116. if ($multiselect) {
  39117. return $multiselectChoices;
  39118. }
  39119. return current($multiselectChoices);
  39120. };
  39121. }
  39122. }
  39123. <?php
  39124. namespace Symfony\Component\Console\Question;
  39125. class ConfirmationQuestion extends Question
  39126. {
  39127. private $trueAnswerRegex;
  39128. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  39129. {
  39130. parent::__construct($question, (bool) $default);
  39131. $this->trueAnswerRegex = $trueAnswerRegex;
  39132. $this->setNormalizer($this->getDefaultNormalizer());
  39133. }
  39134. private function getDefaultNormalizer()
  39135. {
  39136. $default = $this->getDefault();
  39137. $regex = $this->trueAnswerRegex;
  39138. return function ($answer) use ($default, $regex) {
  39139. if (\is_bool($answer)) {
  39140. return $answer;
  39141. }
  39142. $answerIsTrue = (bool) preg_match($regex, $answer);
  39143. if (false === $default) {
  39144. return $answer && $answerIsTrue;
  39145. }
  39146. return !$answer || $answerIsTrue;
  39147. };
  39148. }
  39149. }
  39150. <?php
  39151. namespace Symfony\Component\Console\Question;
  39152. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39153. use Symfony\Component\Console\Exception\LogicException;
  39154. class Question
  39155. {
  39156. private $question;
  39157. private $attempts;
  39158. private $hidden = false;
  39159. private $hiddenFallback = true;
  39160. private $autocompleterValues;
  39161. private $validator;
  39162. private $default;
  39163. private $normalizer;
  39164. public function __construct($question, $default = null)
  39165. {
  39166. $this->question = $question;
  39167. $this->default = $default;
  39168. }
  39169. public function getQuestion()
  39170. {
  39171. return $this->question;
  39172. }
  39173. public function getDefault()
  39174. {
  39175. return $this->default;
  39176. }
  39177. public function isHidden()
  39178. {
  39179. return $this->hidden;
  39180. }
  39181. public function setHidden($hidden)
  39182. {
  39183. if ($this->autocompleterValues) {
  39184. throw new LogicException('A hidden question cannot use the autocompleter.');
  39185. }
  39186. $this->hidden = (bool) $hidden;
  39187. return $this;
  39188. }
  39189. public function isHiddenFallback()
  39190. {
  39191. return $this->hiddenFallback;
  39192. }
  39193. public function setHiddenFallback($fallback)
  39194. {
  39195. $this->hiddenFallback = (bool) $fallback;
  39196. return $this;
  39197. }
  39198. public function getAutocompleterValues()
  39199. {
  39200. return $this->autocompleterValues;
  39201. }
  39202. public function setAutocompleterValues($values)
  39203. {
  39204. if (\is_array($values)) {
  39205. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  39206. }
  39207. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  39208. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  39209. }
  39210. if ($this->hidden) {
  39211. throw new LogicException('A hidden question cannot use the autocompleter.');
  39212. }
  39213. $this->autocompleterValues = $values;
  39214. return $this;
  39215. }
  39216. public function setValidator($validator)
  39217. {
  39218. $this->validator = $validator;
  39219. return $this;
  39220. }
  39221. public function getValidator()
  39222. {
  39223. return $this->validator;
  39224. }
  39225. public function setMaxAttempts($attempts)
  39226. {
  39227. if (null !== $attempts && $attempts < 1) {
  39228. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  39229. }
  39230. $this->attempts = $attempts;
  39231. return $this;
  39232. }
  39233. public function getMaxAttempts()
  39234. {
  39235. return $this->attempts;
  39236. }
  39237. public function setNormalizer($normalizer)
  39238. {
  39239. $this->normalizer = $normalizer;
  39240. return $this;
  39241. }
  39242. public function getNormalizer()
  39243. {
  39244. return $this->normalizer;
  39245. }
  39246. protected function isAssoc($array)
  39247. {
  39248. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  39249. }
  39250. }
  39251. <?php
  39252. namespace Symfony\Component\Console;
  39253. use Symfony\Component\Console\Exception\RuntimeException;
  39254. use Symfony\Component\Console\Input\StringInput;
  39255. use Symfony\Component\Console\Output\ConsoleOutput;
  39256. use Symfony\Component\Process\PhpExecutableFinder;
  39257. use Symfony\Component\Process\ProcessBuilder;
  39258. class Shell
  39259. {
  39260. private $application;
  39261. private $history;
  39262. private $output;
  39263. private $hasReadline;
  39264. private $processIsolation = false;
  39265. public function __construct(Application $application)
  39266. {
  39267. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39268. $this->hasReadline = \function_exists('readline');
  39269. $this->application = $application;
  39270. $this->history = getenv('HOME').'/.history_'.$application->getName();
  39271. $this->output = new ConsoleOutput();
  39272. }
  39273. public function run()
  39274. {
  39275. $this->application->setAutoExit(false);
  39276. $this->application->setCatchExceptions(true);
  39277. if ($this->hasReadline) {
  39278. readline_read_history($this->history);
  39279. readline_completion_function(array($this, 'autocompleter'));
  39280. }
  39281. $this->output->writeln($this->getHeader());
  39282. $php = null;
  39283. if ($this->processIsolation) {
  39284. $finder = new PhpExecutableFinder();
  39285. $php = $finder->find();
  39286. $this->output->writeln(<<<'EOF'
  39287. <info>Running with process isolation, you should consider this:</info>
  39288. * each command is executed as separate process,
  39289. * commands don't support interactivity, all params must be passed explicitly,
  39290. * commands output is not colorized.
  39291. EOF
  39292. );
  39293. }
  39294. while (true) {
  39295. $command = $this->readline();
  39296. if (false === $command) {
  39297. $this->output->writeln("\n");
  39298. break;
  39299. }
  39300. if ($this->hasReadline) {
  39301. readline_add_history($command);
  39302. readline_write_history($this->history);
  39303. }
  39304. if ($this->processIsolation) {
  39305. $pb = new ProcessBuilder();
  39306. $process = $pb
  39307. ->add($php)
  39308. ->add($_SERVER['argv'][0])
  39309. ->add($command)
  39310. ->inheritEnvironmentVariables(true)
  39311. ->getProcess()
  39312. ;
  39313. $output = $this->output;
  39314. $process->run(function ($type, $data) use ($output) {
  39315. $output->writeln($data);
  39316. });
  39317. $ret = $process->getExitCode();
  39318. } else {
  39319. $ret = $this->application->run(new StringInput($command), $this->output);
  39320. }
  39321. if (0 !== $ret) {
  39322. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  39323. }
  39324. }
  39325. }
  39326. protected function getHeader()
  39327. {
  39328. return <<<EOF
  39329. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  39330. At the prompt, type <comment>help</comment> for some help,
  39331. or <comment>list</comment> to get a list of available commands.
  39332. To exit the shell, type <comment>^D</comment>.
  39333. EOF;
  39334. }
  39335. protected function getPrompt()
  39336. {
  39337. return $this->output->getFormatter()->format($this->application->getName().' > ');
  39338. }
  39339. protected function getOutput()
  39340. {
  39341. return $this->output;
  39342. }
  39343. protected function getApplication()
  39344. {
  39345. return $this->application;
  39346. }
  39347. private function autocompleter($text)
  39348. {
  39349. $info = readline_info();
  39350. $text = substr($info['line_buffer'], 0, $info['end']);
  39351. if ($info['point'] !== $info['end']) {
  39352. return true;
  39353. }
  39354. if (false === strpos($text, ' ') || !$text) {
  39355. return array_keys($this->application->all());
  39356. }
  39357. try {
  39358. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  39359. } catch (\Exception $e) {
  39360. return true;
  39361. }
  39362. $list = array('--help');
  39363. foreach ($command->getDefinition()->getOptions() as $option) {
  39364. $list[] = '--'.$option->getName();
  39365. }
  39366. return $list;
  39367. }
  39368. private function readline()
  39369. {
  39370. if ($this->hasReadline) {
  39371. $line = readline($this->getPrompt());
  39372. } else {
  39373. $this->output->write($this->getPrompt());
  39374. $line = fgets(STDIN, 1024);
  39375. $line = (false === $line || '' === $line) ? false : rtrim($line);
  39376. }
  39377. return $line;
  39378. }
  39379. public function getProcessIsolation()
  39380. {
  39381. return $this->processIsolation;
  39382. }
  39383. public function setProcessIsolation($processIsolation)
  39384. {
  39385. $this->processIsolation = (bool) $processIsolation;
  39386. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  39387. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  39388. }
  39389. }
  39390. }
  39391. <?php
  39392. namespace Symfony\Component\Console\Style;
  39393. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  39394. use Symfony\Component\Console\Helper\ProgressBar;
  39395. use Symfony\Component\Console\Output\OutputInterface;
  39396. abstract class OutputStyle implements OutputInterface, StyleInterface
  39397. {
  39398. private $output;
  39399. public function __construct(OutputInterface $output)
  39400. {
  39401. $this->output = $output;
  39402. }
  39403. public function newLine($count = 1)
  39404. {
  39405. $this->output->write(str_repeat(PHP_EOL, $count));
  39406. }
  39407. public function createProgressBar($max = 0)
  39408. {
  39409. return new ProgressBar($this->output, $max);
  39410. }
  39411. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39412. {
  39413. $this->output->write($messages, $newline, $type);
  39414. }
  39415. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39416. {
  39417. $this->output->writeln($messages, $type);
  39418. }
  39419. public function setVerbosity($level)
  39420. {
  39421. $this->output->setVerbosity($level);
  39422. }
  39423. public function getVerbosity()
  39424. {
  39425. return $this->output->getVerbosity();
  39426. }
  39427. public function setDecorated($decorated)
  39428. {
  39429. $this->output->setDecorated($decorated);
  39430. }
  39431. public function isDecorated()
  39432. {
  39433. return $this->output->isDecorated();
  39434. }
  39435. public function setFormatter(OutputFormatterInterface $formatter)
  39436. {
  39437. $this->output->setFormatter($formatter);
  39438. }
  39439. public function getFormatter()
  39440. {
  39441. return $this->output->getFormatter();
  39442. }
  39443. }
  39444. <?php
  39445. namespace Symfony\Component\Console\Style;
  39446. interface StyleInterface
  39447. {
  39448. public function title($message);
  39449. public function section($message);
  39450. public function listing(array $elements);
  39451. public function text($message);
  39452. public function success($message);
  39453. public function error($message);
  39454. public function warning($message);
  39455. public function note($message);
  39456. public function caution($message);
  39457. public function table(array $headers, array $rows);
  39458. public function ask($question, $default = null, $validator = null);
  39459. public function askHidden($question, $validator = null);
  39460. public function confirm($question, $default = true);
  39461. public function choice($question, array $choices, $default = null);
  39462. public function newLine($count = 1);
  39463. public function progressStart($max = 0);
  39464. public function progressAdvance($step = 1);
  39465. public function progressFinish();
  39466. }
  39467. <?php
  39468. namespace Symfony\Component\Console\Style;
  39469. use Symfony\Component\Console\Application;
  39470. use Symfony\Component\Console\Exception\RuntimeException;
  39471. use Symfony\Component\Console\Formatter\OutputFormatter;
  39472. use Symfony\Component\Console\Helper\Helper;
  39473. use Symfony\Component\Console\Helper\ProgressBar;
  39474. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  39475. use Symfony\Component\Console\Helper\Table;
  39476. use Symfony\Component\Console\Input\InputInterface;
  39477. use Symfony\Component\Console\Output\BufferedOutput;
  39478. use Symfony\Component\Console\Output\OutputInterface;
  39479. use Symfony\Component\Console\Question\ChoiceQuestion;
  39480. use Symfony\Component\Console\Question\ConfirmationQuestion;
  39481. use Symfony\Component\Console\Question\Question;
  39482. class SymfonyStyle extends OutputStyle
  39483. {
  39484. const MAX_LINE_LENGTH = 120;
  39485. private $input;
  39486. private $questionHelper;
  39487. private $progressBar;
  39488. private $lineLength;
  39489. private $bufferedOutput;
  39490. public function __construct(InputInterface $input, OutputInterface $output)
  39491. {
  39492. $this->input = $input;
  39493. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  39494. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  39495. parent::__construct($output);
  39496. }
  39497. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  39498. {
  39499. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  39500. $this->autoPrependBlock();
  39501. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  39502. $this->newLine();
  39503. }
  39504. public function title($message)
  39505. {
  39506. $this->autoPrependBlock();
  39507. $this->writeln(array(
  39508. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39509. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39510. ));
  39511. $this->newLine();
  39512. }
  39513. public function section($message)
  39514. {
  39515. $this->autoPrependBlock();
  39516. $this->writeln(array(
  39517. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39518. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39519. ));
  39520. $this->newLine();
  39521. }
  39522. public function listing(array $elements)
  39523. {
  39524. $this->autoPrependText();
  39525. $elements = array_map(function ($element) {
  39526. return sprintf(' * %s', $element);
  39527. }, $elements);
  39528. $this->writeln($elements);
  39529. $this->newLine();
  39530. }
  39531. public function text($message)
  39532. {
  39533. $this->autoPrependText();
  39534. $messages = \is_array($message) ? array_values($message) : array($message);
  39535. foreach ($messages as $message) {
  39536. $this->writeln(sprintf(' %s', $message));
  39537. }
  39538. }
  39539. public function comment($message)
  39540. {
  39541. $messages = \is_array($message) ? array_values($message) : array($message);
  39542. $this->autoPrependBlock();
  39543. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  39544. $this->newLine();
  39545. }
  39546. public function success($message)
  39547. {
  39548. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  39549. }
  39550. public function error($message)
  39551. {
  39552. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  39553. }
  39554. public function warning($message)
  39555. {
  39556. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  39557. }
  39558. public function note($message)
  39559. {
  39560. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  39561. }
  39562. public function caution($message)
  39563. {
  39564. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  39565. }
  39566. public function table(array $headers, array $rows)
  39567. {
  39568. $style = clone Table::getStyleDefinition('symfony-style-guide');
  39569. $style->setCellHeaderFormat('<info>%s</info>');
  39570. $table = new Table($this);
  39571. $table->setHeaders($headers);
  39572. $table->setRows($rows);
  39573. $table->setStyle($style);
  39574. $table->render();
  39575. $this->newLine();
  39576. }
  39577. public function ask($question, $default = null, $validator = null)
  39578. {
  39579. $question = new Question($question, $default);
  39580. $question->setValidator($validator);
  39581. return $this->askQuestion($question);
  39582. }
  39583. public function askHidden($question, $validator = null)
  39584. {
  39585. $question = new Question($question);
  39586. $question->setHidden(true);
  39587. $question->setValidator($validator);
  39588. return $this->askQuestion($question);
  39589. }
  39590. public function confirm($question, $default = true)
  39591. {
  39592. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  39593. }
  39594. public function choice($question, array $choices, $default = null)
  39595. {
  39596. if (null !== $default) {
  39597. $values = array_flip($choices);
  39598. $default = $values[$default];
  39599. }
  39600. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  39601. }
  39602. public function progressStart($max = 0)
  39603. {
  39604. $this->progressBar = $this->createProgressBar($max);
  39605. $this->progressBar->start();
  39606. }
  39607. public function progressAdvance($step = 1)
  39608. {
  39609. $this->getProgressBar()->advance($step);
  39610. }
  39611. public function progressFinish()
  39612. {
  39613. $this->getProgressBar()->finish();
  39614. $this->newLine(2);
  39615. $this->progressBar = null;
  39616. }
  39617. public function createProgressBar($max = 0)
  39618. {
  39619. $progressBar = parent::createProgressBar($max);
  39620. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  39621. $progressBar->setEmptyBarCharacter('â–‘');
  39622. $progressBar->setProgressCharacter('');
  39623. $progressBar->setBarCharacter('â–“');
  39624. }
  39625. return $progressBar;
  39626. }
  39627. public function askQuestion(Question $question)
  39628. {
  39629. if ($this->input->isInteractive()) {
  39630. $this->autoPrependBlock();
  39631. }
  39632. if (!$this->questionHelper) {
  39633. $this->questionHelper = new SymfonyQuestionHelper();
  39634. }
  39635. $answer = $this->questionHelper->ask($this->input, $this, $question);
  39636. if ($this->input->isInteractive()) {
  39637. $this->newLine();
  39638. $this->bufferedOutput->write("\n");
  39639. }
  39640. return $answer;
  39641. }
  39642. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39643. {
  39644. parent::writeln($messages, $type);
  39645. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  39646. }
  39647. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39648. {
  39649. parent::write($messages, $newline, $type);
  39650. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  39651. }
  39652. public function newLine($count = 1)
  39653. {
  39654. parent::newLine($count);
  39655. $this->bufferedOutput->write(str_repeat("\n", $count));
  39656. }
  39657. private function getProgressBar()
  39658. {
  39659. if (!$this->progressBar) {
  39660. throw new RuntimeException('The ProgressBar is not started.');
  39661. }
  39662. return $this->progressBar;
  39663. }
  39664. private function getTerminalWidth()
  39665. {
  39666. $application = new Application();
  39667. $dimensions = $application->getTerminalDimensions();
  39668. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  39669. }
  39670. private function autoPrependBlock()
  39671. {
  39672. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  39673. if (!isset($chars[0])) {
  39674. return $this->newLine();
  39675. }
  39676. $this->newLine(2 - substr_count($chars, "\n"));
  39677. }
  39678. private function autoPrependText()
  39679. {
  39680. $fetched = $this->bufferedOutput->fetch();
  39681. if ("\n" !== substr($fetched, -1)) {
  39682. $this->newLine();
  39683. }
  39684. }
  39685. private function reduceBuffer($messages)
  39686. {
  39687. return array_map(function ($value) {
  39688. return substr($value, -4);
  39689. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  39690. }
  39691. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  39692. {
  39693. $indentLength = 0;
  39694. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  39695. $lines = array();
  39696. if (null !== $type) {
  39697. $type = sprintf('[%s] ', $type);
  39698. $indentLength = \strlen($type);
  39699. $lineIndentation = str_repeat(' ', $indentLength);
  39700. }
  39701. foreach ($messages as $key => $message) {
  39702. if ($escape) {
  39703. $message = OutputFormatter::escape($message);
  39704. }
  39705. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  39706. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  39707. $lines[] = '';
  39708. }
  39709. }
  39710. $firstLineIndex = 0;
  39711. if ($padding && $this->isDecorated()) {
  39712. $firstLineIndex = 1;
  39713. array_unshift($lines, '');
  39714. $lines[] = '';
  39715. }
  39716. foreach ($lines as $i => &$line) {
  39717. if (null !== $type) {
  39718. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  39719. }
  39720. $line = $prefix.$line;
  39721. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  39722. if ($style) {
  39723. $line = sprintf('<%s>%s</>', $style, $line);
  39724. }
  39725. }
  39726. return $lines;
  39727. }
  39728. }
  39729. <?php
  39730. namespace Symfony\Component\Console\Tester;
  39731. use Symfony\Component\Console\Application;
  39732. use Symfony\Component\Console\Input\ArrayInput;
  39733. use Symfony\Component\Console\Input\InputInterface;
  39734. use Symfony\Component\Console\Output\OutputInterface;
  39735. use Symfony\Component\Console\Output\StreamOutput;
  39736. class ApplicationTester
  39737. {
  39738. private $application;
  39739. private $input;
  39740. private $output;
  39741. private $statusCode;
  39742. public function __construct(Application $application)
  39743. {
  39744. $this->application = $application;
  39745. }
  39746. public function run(array $input, $options = array())
  39747. {
  39748. $this->input = new ArrayInput($input);
  39749. if (isset($options['interactive'])) {
  39750. $this->input->setInteractive($options['interactive']);
  39751. }
  39752. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39753. if (isset($options['decorated'])) {
  39754. $this->output->setDecorated($options['decorated']);
  39755. }
  39756. if (isset($options['verbosity'])) {
  39757. $this->output->setVerbosity($options['verbosity']);
  39758. }
  39759. return $this->statusCode = $this->application->run($this->input, $this->output);
  39760. }
  39761. public function getDisplay($normalize = false)
  39762. {
  39763. rewind($this->output->getStream());
  39764. $display = stream_get_contents($this->output->getStream());
  39765. if ($normalize) {
  39766. $display = str_replace(PHP_EOL, "\n", $display);
  39767. }
  39768. return $display;
  39769. }
  39770. public function getInput()
  39771. {
  39772. return $this->input;
  39773. }
  39774. public function getOutput()
  39775. {
  39776. return $this->output;
  39777. }
  39778. public function getStatusCode()
  39779. {
  39780. return $this->statusCode;
  39781. }
  39782. }
  39783. <?php
  39784. namespace Symfony\Component\Console\Tester;
  39785. use Symfony\Component\Console\Command\Command;
  39786. use Symfony\Component\Console\Input\ArrayInput;
  39787. use Symfony\Component\Console\Input\InputInterface;
  39788. use Symfony\Component\Console\Output\OutputInterface;
  39789. use Symfony\Component\Console\Output\StreamOutput;
  39790. class CommandTester
  39791. {
  39792. private $command;
  39793. private $input;
  39794. private $output;
  39795. private $statusCode;
  39796. public function __construct(Command $command)
  39797. {
  39798. $this->command = $command;
  39799. }
  39800. public function execute(array $input, array $options = array())
  39801. {
  39802. if (!isset($input['command'])
  39803. && (null !== $application = $this->command->getApplication())
  39804. && $application->getDefinition()->hasArgument('command')
  39805. ) {
  39806. $input = array_merge(array('command' => $this->command->getName()), $input);
  39807. }
  39808. $this->input = new ArrayInput($input);
  39809. if (isset($options['interactive'])) {
  39810. $this->input->setInteractive($options['interactive']);
  39811. }
  39812. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39813. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  39814. if (isset($options['verbosity'])) {
  39815. $this->output->setVerbosity($options['verbosity']);
  39816. }
  39817. return $this->statusCode = $this->command->run($this->input, $this->output);
  39818. }
  39819. public function getDisplay($normalize = false)
  39820. {
  39821. rewind($this->output->getStream());
  39822. $display = stream_get_contents($this->output->getStream());
  39823. if ($normalize) {
  39824. $display = str_replace(PHP_EOL, "\n", $display);
  39825. }
  39826. return $display;
  39827. }
  39828. public function getInput()
  39829. {
  39830. return $this->input;
  39831. }
  39832. public function getOutput()
  39833. {
  39834. return $this->output;
  39835. }
  39836. public function getStatusCode()
  39837. {
  39838. return $this->statusCode;
  39839. }
  39840. }
  39841. <?php
  39842. namespace Symfony\Component\Debug;
  39843. use Psr\Log\AbstractLogger;
  39844. class BufferingLogger extends AbstractLogger
  39845. {
  39846. private $logs = array();
  39847. public function log($level, $message, array $context = array())
  39848. {
  39849. $this->logs[] = array($level, $message, $context);
  39850. }
  39851. public function cleanLogs()
  39852. {
  39853. $logs = $this->logs;
  39854. $this->logs = array();
  39855. return $logs;
  39856. }
  39857. }
  39858. <?php
  39859. namespace Symfony\Component\Debug;
  39860. class Debug
  39861. {
  39862. private static $enabled = false;
  39863. public static function enable($errorReportingLevel = null, $displayErrors = true)
  39864. {
  39865. if (static::$enabled) {
  39866. return;
  39867. }
  39868. static::$enabled = true;
  39869. if (null !== $errorReportingLevel) {
  39870. error_reporting($errorReportingLevel);
  39871. } else {
  39872. error_reporting(-1);
  39873. }
  39874. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  39875. ini_set('display_errors', 0);
  39876. ExceptionHandler::register();
  39877. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  39878. ini_set('display_errors', 1);
  39879. }
  39880. if ($displayErrors) {
  39881. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  39882. } else {
  39883. ErrorHandler::register()->throwAt(0, true);
  39884. }
  39885. DebugClassLoader::enable();
  39886. }
  39887. }
  39888. <?php
  39889. namespace Symfony\Component\Debug;
  39890. class DebugClassLoader
  39891. {
  39892. private $classLoader;
  39893. private $isFinder;
  39894. private $loaded = array();
  39895. private $wasFinder;
  39896. private static $caseCheck;
  39897. private static $deprecated = array();
  39898. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  39899. private static $darwinCache = array('/' => array('/', array()));
  39900. public function __construct($classLoader)
  39901. {
  39902. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  39903. if ($this->wasFinder) {
  39904. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  39905. $this->classLoader = array($classLoader, 'loadClass');
  39906. $this->isFinder = true;
  39907. } else {
  39908. $this->classLoader = $classLoader;
  39909. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  39910. }
  39911. if (!isset(self::$caseCheck)) {
  39912. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  39913. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  39914. $dir = substr($file, 0, 1 + $i);
  39915. $file = substr($file, 1 + $i);
  39916. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  39917. $test = realpath($dir.$test);
  39918. if (false === $test || false === $i) {
  39919. self::$caseCheck = 0;
  39920. } elseif (substr($test, -\strlen($file)) === $file) {
  39921. self::$caseCheck = 1;
  39922. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  39923. self::$caseCheck = 2;
  39924. } else {
  39925. self::$caseCheck = 0;
  39926. }
  39927. }
  39928. }
  39929. public function getClassLoader()
  39930. {
  39931. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  39932. }
  39933. public static function enable()
  39934. {
  39935. class_exists('Symfony\Component\Debug\ErrorHandler');
  39936. class_exists('Psr\Log\LogLevel');
  39937. if (!\is_array($functions = spl_autoload_functions())) {
  39938. return;
  39939. }
  39940. foreach ($functions as $function) {
  39941. spl_autoload_unregister($function);
  39942. }
  39943. foreach ($functions as $function) {
  39944. if (!\is_array($function) || !$function[0] instanceof self) {
  39945. $function = array(new static($function), 'loadClass');
  39946. }
  39947. spl_autoload_register($function);
  39948. }
  39949. }
  39950. public static function disable()
  39951. {
  39952. if (!\is_array($functions = spl_autoload_functions())) {
  39953. return;
  39954. }
  39955. foreach ($functions as $function) {
  39956. spl_autoload_unregister($function);
  39957. }
  39958. foreach ($functions as $function) {
  39959. if (\is_array($function) && $function[0] instanceof self) {
  39960. $function = $function[0]->getClassLoader();
  39961. }
  39962. spl_autoload_register($function);
  39963. }
  39964. }
  39965. public function findFile($class)
  39966. {
  39967. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39968. if ($this->wasFinder) {
  39969. return $this->classLoader[0]->findFile($class);
  39970. }
  39971. }
  39972. public function loadClass($class)
  39973. {
  39974. ErrorHandler::stackErrors();
  39975. try {
  39976. if ($this->isFinder && !isset($this->loaded[$class])) {
  39977. $this->loaded[$class] = true;
  39978. if ($file = $this->classLoader[0]->findFile($class)) {
  39979. require $file;
  39980. }
  39981. } else {
  39982. \call_user_func($this->classLoader, $class);
  39983. $file = false;
  39984. }
  39985. } catch (\Exception $e) {
  39986. ErrorHandler::unstackErrors();
  39987. throw $e;
  39988. } catch (\Throwable $e) {
  39989. ErrorHandler::unstackErrors();
  39990. throw $e;
  39991. }
  39992. ErrorHandler::unstackErrors();
  39993. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  39994. if ($class && '\\' === $class[0]) {
  39995. $class = substr($class, 1);
  39996. }
  39997. if ($exists) {
  39998. $refl = new \ReflectionClass($class);
  39999. $name = $refl->getName();
  40000. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  40001. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  40002. }
  40003. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  40004. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  40005. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  40006. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  40007. } else {
  40008. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  40009. $len = 0;
  40010. $ns = '';
  40011. } else {
  40012. $ns = substr($name, 0, $len);
  40013. }
  40014. $parent = get_parent_class($class);
  40015. if (!$parent || strncmp($ns, $parent, $len)) {
  40016. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  40017. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  40018. }
  40019. $parentInterfaces = array();
  40020. $deprecatedInterfaces = array();
  40021. if ($parent) {
  40022. foreach (class_implements($parent) as $interface) {
  40023. $parentInterfaces[$interface] = 1;
  40024. }
  40025. }
  40026. foreach ($refl->getInterfaceNames() as $interface) {
  40027. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  40028. $deprecatedInterfaces[] = $interface;
  40029. }
  40030. foreach (class_implements($interface) as $interface) {
  40031. $parentInterfaces[$interface] = 1;
  40032. }
  40033. }
  40034. foreach ($deprecatedInterfaces as $interface) {
  40035. if (!isset($parentInterfaces[$interface])) {
  40036. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  40037. }
  40038. }
  40039. }
  40040. }
  40041. }
  40042. if ($file) {
  40043. if (!$exists) {
  40044. if (false !== strpos($class, '/')) {
  40045. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  40046. }
  40047. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  40048. }
  40049. if (self::$caseCheck) {
  40050. $real = explode('\\', $class.strrchr($file, '.'));
  40051. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  40052. $i = \count($tail) - 1;
  40053. $j = \count($real) - 1;
  40054. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  40055. --$i;
  40056. --$j;
  40057. }
  40058. array_splice($tail, 0, $i + 1);
  40059. }
  40060. if (self::$caseCheck && $tail) {
  40061. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  40062. $tailLen = \strlen($tail);
  40063. $real = $refl->getFileName();
  40064. if (2 === self::$caseCheck) {
  40065. $i = 1 + strrpos($real, '/');
  40066. $file = substr($real, $i);
  40067. $real = substr($real, 0, $i);
  40068. if (isset(self::$darwinCache[$real])) {
  40069. $kDir = $real;
  40070. } else {
  40071. $kDir = strtolower($real);
  40072. if (isset(self::$darwinCache[$kDir])) {
  40073. $real = self::$darwinCache[$kDir][0];
  40074. } else {
  40075. $dir = getcwd();
  40076. chdir($real);
  40077. $real = getcwd().'/';
  40078. chdir($dir);
  40079. $dir = $real;
  40080. $k = $kDir;
  40081. $i = \strlen($dir) - 1;
  40082. while (!isset(self::$darwinCache[$k])) {
  40083. self::$darwinCache[$k] = array($dir, array());
  40084. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  40085. while ('/' !== $dir[--$i]) {
  40086. }
  40087. $k = substr($k, 0, ++$i);
  40088. $dir = substr($dir, 0, $i--);
  40089. }
  40090. }
  40091. }
  40092. $dirFiles = self::$darwinCache[$kDir][1];
  40093. if (isset($dirFiles[$file])) {
  40094. $kFile = $file;
  40095. } else {
  40096. $kFile = strtolower($file);
  40097. if (!isset($dirFiles[$kFile])) {
  40098. foreach (scandir($real, 2) as $f) {
  40099. if ('.' !== $f[0]) {
  40100. $dirFiles[$f] = $f;
  40101. if ($f === $file) {
  40102. $kFile = $k = $file;
  40103. } elseif ($f !== $k = strtolower($f)) {
  40104. $dirFiles[$k] = $f;
  40105. }
  40106. }
  40107. }
  40108. self::$darwinCache[$kDir][1] = $dirFiles;
  40109. }
  40110. }
  40111. $real .= $dirFiles[$kFile];
  40112. }
  40113. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  40114. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  40115. ) {
  40116. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  40117. }
  40118. }
  40119. return true;
  40120. }
  40121. }
  40122. }
  40123. <?php
  40124. namespace Symfony\Component\Debug;
  40125. use Psr\Log\LoggerInterface;
  40126. use Psr\Log\LogLevel;
  40127. use Symfony\Component\Debug\Exception\ContextErrorException;
  40128. use Symfony\Component\Debug\Exception\FatalErrorException;
  40129. use Symfony\Component\Debug\Exception\FatalThrowableError;
  40130. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  40131. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  40132. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  40133. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  40134. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  40135. class ErrorHandler
  40136. {
  40137. const TYPE_DEPRECATION = -100;
  40138. private $levels = array(
  40139. E_DEPRECATED => 'Deprecated',
  40140. E_USER_DEPRECATED => 'User Deprecated',
  40141. E_NOTICE => 'Notice',
  40142. E_USER_NOTICE => 'User Notice',
  40143. E_STRICT => 'Runtime Notice',
  40144. E_WARNING => 'Warning',
  40145. E_USER_WARNING => 'User Warning',
  40146. E_COMPILE_WARNING => 'Compile Warning',
  40147. E_CORE_WARNING => 'Core Warning',
  40148. E_USER_ERROR => 'User Error',
  40149. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  40150. E_COMPILE_ERROR => 'Compile Error',
  40151. E_PARSE => 'Parse Error',
  40152. E_ERROR => 'Error',
  40153. E_CORE_ERROR => 'Core Error',
  40154. );
  40155. private $loggers = array(
  40156. E_DEPRECATED => array(null, LogLevel::INFO),
  40157. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  40158. E_NOTICE => array(null, LogLevel::WARNING),
  40159. E_USER_NOTICE => array(null, LogLevel::WARNING),
  40160. E_STRICT => array(null, LogLevel::WARNING),
  40161. E_WARNING => array(null, LogLevel::WARNING),
  40162. E_USER_WARNING => array(null, LogLevel::WARNING),
  40163. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  40164. E_CORE_WARNING => array(null, LogLevel::WARNING),
  40165. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  40166. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  40167. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  40168. E_PARSE => array(null, LogLevel::CRITICAL),
  40169. E_ERROR => array(null, LogLevel::CRITICAL),
  40170. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  40171. );
  40172. private $thrownErrors = 0x1FFF;
  40173. private $scopedErrors = 0x1FFF;
  40174. private $tracedErrors = 0x77FB;
  40175. private $screamedErrors = 0x55;
  40176. private $loggedErrors = 0;
  40177. private $loggedTraces = array();
  40178. private $isRecursive = 0;
  40179. private $isRoot = false;
  40180. private $exceptionHandler;
  40181. private $bootstrappingLogger;
  40182. private static $reservedMemory;
  40183. private static $stackedErrors = array();
  40184. private static $stackedErrorLevels = array();
  40185. private static $toStringException = null;
  40186. private static $exitCode = 0;
  40187. private $displayErrors = 0x1FFF;
  40188. public static function register($handler = null, $replace = true)
  40189. {
  40190. if (null === self::$reservedMemory) {
  40191. self::$reservedMemory = str_repeat('x', 10240);
  40192. register_shutdown_function(__CLASS__.'::handleFatalError');
  40193. }
  40194. $levels = -1;
  40195. if ($handlerIsNew = !$handler instanceof self) {
  40196. if (null !== $handler) {
  40197. $levels = $replace ? $handler : 0;
  40198. $replace = true;
  40199. }
  40200. $handler = new static();
  40201. }
  40202. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  40203. restore_error_handler();
  40204. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  40205. $handler->isRoot = true;
  40206. }
  40207. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  40208. $handler = $prev[0];
  40209. $replace = false;
  40210. }
  40211. if (!$replace && $prev) {
  40212. restore_error_handler();
  40213. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  40214. } else {
  40215. $handlerIsRegistered = true;
  40216. }
  40217. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  40218. restore_exception_handler();
  40219. if (!$handlerIsRegistered) {
  40220. $handler = $prev[0];
  40221. } elseif ($handler !== $prev[0] && $replace) {
  40222. set_exception_handler(array($handler, 'handleException'));
  40223. $p = $prev[0]->setExceptionHandler(null);
  40224. $handler->setExceptionHandler($p);
  40225. $prev[0]->setExceptionHandler($p);
  40226. }
  40227. } else {
  40228. $handler->setExceptionHandler($prev);
  40229. }
  40230. $handler->throwAt($levels & $handler->thrownErrors, true);
  40231. return $handler;
  40232. }
  40233. public function __construct(BufferingLogger $bootstrappingLogger = null)
  40234. {
  40235. if ($bootstrappingLogger) {
  40236. $this->bootstrappingLogger = $bootstrappingLogger;
  40237. $this->setDefaultLogger($bootstrappingLogger);
  40238. }
  40239. }
  40240. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  40241. {
  40242. $loggers = array();
  40243. if (\is_array($levels)) {
  40244. foreach ($levels as $type => $logLevel) {
  40245. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  40246. $loggers[$type] = array($logger, $logLevel);
  40247. }
  40248. }
  40249. } else {
  40250. if (null === $levels) {
  40251. $levels = E_ALL | E_STRICT;
  40252. }
  40253. foreach ($this->loggers as $type => $log) {
  40254. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  40255. $log[0] = $logger;
  40256. $loggers[$type] = $log;
  40257. }
  40258. }
  40259. }
  40260. $this->setLoggers($loggers);
  40261. }
  40262. public function setLoggers(array $loggers)
  40263. {
  40264. $prevLogged = $this->loggedErrors;
  40265. $prev = $this->loggers;
  40266. $flush = array();
  40267. foreach ($loggers as $type => $log) {
  40268. if (!isset($prev[$type])) {
  40269. throw new \InvalidArgumentException('Unknown error type: '.$type);
  40270. }
  40271. if (!\is_array($log)) {
  40272. $log = array($log);
  40273. } elseif (!array_key_exists(0, $log)) {
  40274. throw new \InvalidArgumentException('No logger provided');
  40275. }
  40276. if (null === $log[0]) {
  40277. $this->loggedErrors &= ~$type;
  40278. } elseif ($log[0] instanceof LoggerInterface) {
  40279. $this->loggedErrors |= $type;
  40280. } else {
  40281. throw new \InvalidArgumentException('Invalid logger provided');
  40282. }
  40283. $this->loggers[$type] = $log + $prev[$type];
  40284. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  40285. $flush[$type] = $type;
  40286. }
  40287. }
  40288. $this->reRegister($prevLogged | $this->thrownErrors);
  40289. if ($flush) {
  40290. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  40291. $type = $log[2]['type'];
  40292. if (!isset($flush[$type])) {
  40293. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  40294. } elseif ($this->loggers[$type][0]) {
  40295. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  40296. }
  40297. }
  40298. }
  40299. return $prev;
  40300. }
  40301. public function setExceptionHandler($handler)
  40302. {
  40303. if (null !== $handler && !\is_callable($handler)) {
  40304. throw new \LogicException('The exception handler must be a valid PHP callable.');
  40305. }
  40306. $prev = $this->exceptionHandler;
  40307. $this->exceptionHandler = $handler;
  40308. return $prev;
  40309. }
  40310. public function throwAt($levels, $replace = false)
  40311. {
  40312. $prev = $this->thrownErrors;
  40313. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  40314. if (!$replace) {
  40315. $this->thrownErrors |= $prev;
  40316. }
  40317. $this->reRegister($prev | $this->loggedErrors);
  40318. $this->displayErrors = $this->thrownErrors;
  40319. return $prev;
  40320. }
  40321. public function scopeAt($levels, $replace = false)
  40322. {
  40323. $prev = $this->scopedErrors;
  40324. $this->scopedErrors = (int) $levels;
  40325. if (!$replace) {
  40326. $this->scopedErrors |= $prev;
  40327. }
  40328. return $prev;
  40329. }
  40330. public function traceAt($levels, $replace = false)
  40331. {
  40332. $prev = $this->tracedErrors;
  40333. $this->tracedErrors = (int) $levels;
  40334. if (!$replace) {
  40335. $this->tracedErrors |= $prev;
  40336. }
  40337. return $prev;
  40338. }
  40339. public function screamAt($levels, $replace = false)
  40340. {
  40341. $prev = $this->screamedErrors;
  40342. $this->screamedErrors = (int) $levels;
  40343. if (!$replace) {
  40344. $this->screamedErrors |= $prev;
  40345. }
  40346. return $prev;
  40347. }
  40348. private function reRegister($prev)
  40349. {
  40350. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  40351. $handler = set_error_handler('var_dump');
  40352. $handler = \is_array($handler) ? $handler[0] : null;
  40353. restore_error_handler();
  40354. if ($handler === $this) {
  40355. restore_error_handler();
  40356. if ($this->isRoot) {
  40357. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  40358. } else {
  40359. set_error_handler(array($this, 'handleError'));
  40360. }
  40361. }
  40362. }
  40363. }
  40364. public function handleError($type, $message, $file, $line)
  40365. {
  40366. $level = error_reporting();
  40367. $silenced = 0 === ($level & $type);
  40368. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  40369. $log = $this->loggedErrors & $type;
  40370. $throw = $this->thrownErrors & $type & $level;
  40371. $type &= $level | $this->screamedErrors;
  40372. if (!$type || (!$log && !$throw)) {
  40373. return !$silenced && $type && $log;
  40374. }
  40375. $scope = $this->scopedErrors & $type;
  40376. if (4 < $numArgs = \func_num_args()) {
  40377. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  40378. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  40379. } else {
  40380. $context = array();
  40381. $backtrace = null;
  40382. }
  40383. if (isset($context['GLOBALS']) && $scope) {
  40384. $e = $context;
  40385. unset($e['GLOBALS'], $context);
  40386. $context = $e;
  40387. }
  40388. if (null !== $backtrace && $type & E_ERROR) {
  40389. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  40390. return true;
  40391. }
  40392. if ($throw) {
  40393. if (null !== self::$toStringException) {
  40394. $throw = self::$toStringException;
  40395. self::$toStringException = null;
  40396. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  40397. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  40398. } else {
  40399. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  40400. }
  40401. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  40402. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  40403. }
  40404. if (E_USER_ERROR & $type) {
  40405. $backtrace = $backtrace ?: $throw->getTrace();
  40406. for ($i = 1; isset($backtrace[$i]); ++$i) {
  40407. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  40408. && '__toString' === $backtrace[$i]['function']
  40409. && '->' === $backtrace[$i]['type']
  40410. && !isset($backtrace[$i - 1]['class'])
  40411. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  40412. ) {
  40413. foreach ($context as $e) {
  40414. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  40415. if (1 === $i) {
  40416. $throw = $e;
  40417. break;
  40418. }
  40419. self::$toStringException = $e;
  40420. return true;
  40421. }
  40422. }
  40423. if (1 < $i) {
  40424. $this->handleException($throw);
  40425. return false;
  40426. }
  40427. }
  40428. }
  40429. }
  40430. throw $throw;
  40431. }
  40432. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  40433. $trace = true;
  40434. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  40435. $trace = false;
  40436. } else {
  40437. $this->loggedTraces[$e] = 1;
  40438. }
  40439. $e = compact('type', 'file', 'line', 'level');
  40440. if ($type & $level) {
  40441. if ($scope) {
  40442. $e['scope_vars'] = $context;
  40443. if ($trace) {
  40444. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  40445. }
  40446. } elseif ($trace) {
  40447. if (null === $backtrace) {
  40448. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  40449. } else {
  40450. foreach ($backtrace as &$frame) {
  40451. unset($frame['args'], $frame);
  40452. }
  40453. $e['stack'] = $backtrace;
  40454. }
  40455. }
  40456. }
  40457. if ($this->isRecursive) {
  40458. $log = 0;
  40459. } elseif (self::$stackedErrorLevels) {
  40460. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40461. } else {
  40462. try {
  40463. $this->isRecursive = true;
  40464. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40465. $this->isRecursive = false;
  40466. } catch (\Exception $e) {
  40467. $this->isRecursive = false;
  40468. throw $e;
  40469. } catch (\Throwable $e) {
  40470. $this->isRecursive = false;
  40471. throw $e;
  40472. }
  40473. }
  40474. return !$silenced && $type && $log;
  40475. }
  40476. public function handleException($exception, array $error = null)
  40477. {
  40478. if (null === $error) {
  40479. self::$exitCode = 255;
  40480. }
  40481. if (!$exception instanceof \Exception) {
  40482. $exception = new FatalThrowableError($exception);
  40483. }
  40484. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  40485. $handlerException = null;
  40486. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  40487. $e = array(
  40488. 'type' => $type,
  40489. 'file' => $exception->getFile(),
  40490. 'line' => $exception->getLine(),
  40491. 'level' => error_reporting(),
  40492. 'stack' => $exception->getTrace(),
  40493. );
  40494. if ($exception instanceof FatalErrorException) {
  40495. if ($exception instanceof FatalThrowableError) {
  40496. $error = array(
  40497. 'type' => $type,
  40498. 'message' => $message = $exception->getMessage(),
  40499. 'file' => $e['file'],
  40500. 'line' => $e['line'],
  40501. );
  40502. } else {
  40503. $message = 'Fatal '.$exception->getMessage();
  40504. }
  40505. } elseif ($exception instanceof \ErrorException) {
  40506. $message = 'Uncaught '.$exception->getMessage();
  40507. if ($exception instanceof ContextErrorException) {
  40508. $e['context'] = $exception->getContext();
  40509. }
  40510. } else {
  40511. $message = 'Uncaught Exception: '.$exception->getMessage();
  40512. }
  40513. }
  40514. if ($this->loggedErrors & $type) {
  40515. try {
  40516. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  40517. } catch (\Exception $handlerException) {
  40518. } catch (\Throwable $handlerException) {
  40519. }
  40520. }
  40521. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  40522. foreach ($this->getFatalErrorHandlers() as $handler) {
  40523. if ($e = $handler->handleError($error, $exception)) {
  40524. $exception = $e;
  40525. break;
  40526. }
  40527. }
  40528. }
  40529. $exceptionHandler = $this->exceptionHandler;
  40530. $this->exceptionHandler = null;
  40531. try {
  40532. if (null !== $exceptionHandler) {
  40533. return \call_user_func($exceptionHandler, $exception);
  40534. }
  40535. $handlerException = $handlerException ?: $exception;
  40536. } catch (\Exception $handlerException) {
  40537. } catch (\Throwable $handlerException) {
  40538. }
  40539. if ($exception === $handlerException) {
  40540. self::$reservedMemory = null;
  40541. throw $exception;
  40542. }
  40543. $this->handleException($handlerException);
  40544. }
  40545. public static function handleFatalError(array $error = null)
  40546. {
  40547. if (null === self::$reservedMemory) {
  40548. return;
  40549. }
  40550. $handler = self::$reservedMemory = null;
  40551. $handlers = array();
  40552. $previousHandler = null;
  40553. $sameHandlerLimit = 10;
  40554. while (!\is_array($handler) || !$handler[0] instanceof self) {
  40555. $handler = set_exception_handler('var_dump');
  40556. restore_exception_handler();
  40557. if (!$handler) {
  40558. break;
  40559. }
  40560. restore_exception_handler();
  40561. if ($handler !== $previousHandler) {
  40562. array_unshift($handlers, $handler);
  40563. $previousHandler = $handler;
  40564. } elseif (0 === --$sameHandlerLimit) {
  40565. $handler = null;
  40566. break;
  40567. }
  40568. }
  40569. foreach ($handlers as $h) {
  40570. set_exception_handler($h);
  40571. }
  40572. if (!$handler) {
  40573. return;
  40574. }
  40575. if ($handler !== $h) {
  40576. $handler[0]->setExceptionHandler($h);
  40577. }
  40578. $handler = $handler[0];
  40579. $handlers = array();
  40580. if ($exit = null === $error) {
  40581. $error = error_get_last();
  40582. }
  40583. try {
  40584. while (self::$stackedErrorLevels) {
  40585. static::unstackErrors();
  40586. }
  40587. } catch (\Exception $exception) {
  40588. } catch (\Throwable $exception) {
  40589. }
  40590. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  40591. $handler->throwAt(0, true);
  40592. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  40593. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  40594. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  40595. } else {
  40596. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  40597. }
  40598. }
  40599. try {
  40600. if (isset($exception)) {
  40601. self::$exitCode = 255;
  40602. $handler->handleException($exception, $error);
  40603. }
  40604. } catch (FatalErrorException $e) {
  40605. }
  40606. if ($exit && self::$exitCode) {
  40607. $exitCode = self::$exitCode;
  40608. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  40609. }
  40610. }
  40611. public static function stackErrors()
  40612. {
  40613. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40614. }
  40615. public static function unstackErrors()
  40616. {
  40617. $level = array_pop(self::$stackedErrorLevels);
  40618. if (null !== $level) {
  40619. $e = error_reporting($level);
  40620. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  40621. error_reporting($e);
  40622. }
  40623. }
  40624. if (empty(self::$stackedErrorLevels)) {
  40625. $errors = self::$stackedErrors;
  40626. self::$stackedErrors = array();
  40627. foreach ($errors as $e) {
  40628. $e[0]->log($e[1], $e[2], $e[3]);
  40629. }
  40630. }
  40631. }
  40632. protected function getFatalErrorHandlers()
  40633. {
  40634. return array(
  40635. new UndefinedFunctionFatalErrorHandler(),
  40636. new UndefinedMethodFatalErrorHandler(),
  40637. new ClassNotFoundFatalErrorHandler(),
  40638. );
  40639. }
  40640. public function setLevel($level)
  40641. {
  40642. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40643. $level = null === $level ? error_reporting() : $level;
  40644. $this->throwAt($level, true);
  40645. }
  40646. public function setDisplayErrors($displayErrors)
  40647. {
  40648. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40649. if ($displayErrors) {
  40650. $this->throwAt($this->displayErrors, true);
  40651. } else {
  40652. $displayErrors = $this->displayErrors;
  40653. $this->throwAt(0, true);
  40654. $this->displayErrors = $displayErrors;
  40655. }
  40656. }
  40657. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  40658. {
  40659. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  40660. $handler = set_error_handler('var_dump');
  40661. $handler = \is_array($handler) ? $handler[0] : null;
  40662. restore_error_handler();
  40663. if (!$handler instanceof self) {
  40664. return;
  40665. }
  40666. if ('deprecation' === $channel) {
  40667. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  40668. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  40669. } elseif ('scream' === $channel) {
  40670. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  40671. $handler->screamAt(E_ALL | E_STRICT);
  40672. } elseif ('emergency' === $channel) {
  40673. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  40674. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40675. }
  40676. }
  40677. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  40678. {
  40679. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  40680. return $this->handleError($level, $message, $file, $line, (array) $context);
  40681. }
  40682. public function handleFatal()
  40683. {
  40684. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  40685. static::handleFatalError();
  40686. }
  40687. }
  40688. class ErrorHandlerCanary
  40689. {
  40690. private static $displayErrors = null;
  40691. public function __construct()
  40692. {
  40693. if (null === self::$displayErrors) {
  40694. self::$displayErrors = ini_set('display_errors', 1);
  40695. }
  40696. }
  40697. public function __destruct()
  40698. {
  40699. if (null !== self::$displayErrors) {
  40700. ini_set('display_errors', self::$displayErrors);
  40701. self::$displayErrors = null;
  40702. }
  40703. }
  40704. }
  40705. <?php
  40706. namespace Symfony\Component\Debug\Exception;
  40707. class ClassNotFoundException extends FatalErrorException
  40708. {
  40709. public function __construct($message, \ErrorException $previous)
  40710. {
  40711. parent::__construct(
  40712. $message,
  40713. $previous->getCode(),
  40714. $previous->getSeverity(),
  40715. $previous->getFile(),
  40716. $previous->getLine(),
  40717. null,
  40718. true,
  40719. null,
  40720. $previous->getPrevious()
  40721. );
  40722. $this->setTrace($previous->getTrace());
  40723. }
  40724. }
  40725. <?php
  40726. namespace Symfony\Component\Debug\Exception;
  40727. class ContextErrorException extends \ErrorException
  40728. {
  40729. private $context = array();
  40730. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  40731. {
  40732. parent::__construct($message, $code, $severity, $filename, $lineno);
  40733. $this->context = $context;
  40734. }
  40735. public function getContext()
  40736. {
  40737. return $this->context;
  40738. }
  40739. }
  40740. <?php
  40741. namespace Symfony\Component\Debug\Exception;
  40742. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  40743. class DummyException extends \ErrorException
  40744. {
  40745. }
  40746. <?php
  40747. namespace Symfony\Component\HttpKernel\Exception;
  40748. class FatalErrorException extends \ErrorException
  40749. {
  40750. }
  40751. namespace Symfony\Component\Debug\Exception;
  40752. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  40753. class FatalErrorException extends LegacyFatalErrorException
  40754. {
  40755. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  40756. {
  40757. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  40758. if (null !== $trace) {
  40759. if (!$traceArgs) {
  40760. foreach ($trace as &$frame) {
  40761. unset($frame['args'], $frame['this'], $frame);
  40762. }
  40763. }
  40764. $this->setTrace($trace);
  40765. } elseif (null !== $traceOffset) {
  40766. if (\function_exists('xdebug_get_function_stack')) {
  40767. $trace = xdebug_get_function_stack();
  40768. if (0 < $traceOffset) {
  40769. array_splice($trace, -$traceOffset);
  40770. }
  40771. foreach ($trace as &$frame) {
  40772. if (!isset($frame['type'])) {
  40773. if (isset($frame['class'])) {
  40774. $frame['type'] = '::';
  40775. }
  40776. } elseif ('dynamic' === $frame['type']) {
  40777. $frame['type'] = '->';
  40778. } elseif ('static' === $frame['type']) {
  40779. $frame['type'] = '::';
  40780. }
  40781. if (!$traceArgs) {
  40782. unset($frame['params'], $frame['args']);
  40783. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  40784. $frame['args'] = $frame['params'];
  40785. unset($frame['params']);
  40786. }
  40787. }
  40788. unset($frame);
  40789. $trace = array_reverse($trace);
  40790. } elseif (\function_exists('symfony_debug_backtrace')) {
  40791. $trace = symfony_debug_backtrace();
  40792. if (0 < $traceOffset) {
  40793. array_splice($trace, 0, $traceOffset);
  40794. }
  40795. } else {
  40796. $trace = array();
  40797. }
  40798. $this->setTrace($trace);
  40799. }
  40800. }
  40801. protected function setTrace($trace)
  40802. {
  40803. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  40804. $traceReflector->setAccessible(true);
  40805. $traceReflector->setValue($this, $trace);
  40806. }
  40807. }
  40808. <?php
  40809. namespace Symfony\Component\Debug\Exception;
  40810. class FatalThrowableError extends FatalErrorException
  40811. {
  40812. public function __construct(\Throwable $e)
  40813. {
  40814. if ($e instanceof \ParseError) {
  40815. $message = 'Parse error: '.$e->getMessage();
  40816. $severity = E_PARSE;
  40817. } elseif ($e instanceof \TypeError) {
  40818. $message = 'Type error: '.$e->getMessage();
  40819. $severity = E_RECOVERABLE_ERROR;
  40820. } else {
  40821. $message = $e->getMessage();
  40822. $severity = E_ERROR;
  40823. }
  40824. \ErrorException::__construct(
  40825. $message,
  40826. $e->getCode(),
  40827. $severity,
  40828. $e->getFile(),
  40829. $e->getLine(),
  40830. $e->getPrevious()
  40831. );
  40832. $this->setTrace($e->getTrace());
  40833. }
  40834. }
  40835. <?php
  40836. namespace Symfony\Component\HttpKernel\Exception;
  40837. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  40838. class FlattenException
  40839. {
  40840. private $handler;
  40841. public static function __callStatic($method, $args)
  40842. {
  40843. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  40844. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  40845. }
  40846. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  40847. }
  40848. public function __call($method, $args)
  40849. {
  40850. if (!isset($this->handler)) {
  40851. $this->handler = new DebugFlattenException();
  40852. }
  40853. if (!method_exists($this->handler, $method)) {
  40854. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  40855. }
  40856. return \call_user_func_array(array($this->handler, $method), $args);
  40857. }
  40858. }
  40859. namespace Symfony\Component\Debug\Exception;
  40860. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  40861. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  40862. class FlattenException extends LegacyFlattenException
  40863. {
  40864. private $message;
  40865. private $code;
  40866. private $previous;
  40867. private $trace;
  40868. private $class;
  40869. private $statusCode;
  40870. private $headers;
  40871. private $file;
  40872. private $line;
  40873. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  40874. {
  40875. $e = new static();
  40876. $e->setMessage($exception->getMessage());
  40877. $e->setCode($exception->getCode());
  40878. if ($exception instanceof HttpExceptionInterface) {
  40879. $statusCode = $exception->getStatusCode();
  40880. $headers = array_merge($headers, $exception->getHeaders());
  40881. }
  40882. if (null === $statusCode) {
  40883. $statusCode = 500;
  40884. }
  40885. $e->setStatusCode($statusCode);
  40886. $e->setHeaders($headers);
  40887. $e->setTraceFromException($exception);
  40888. $e->setClass(\get_class($exception));
  40889. $e->setFile($exception->getFile());
  40890. $e->setLine($exception->getLine());
  40891. $previous = $exception->getPrevious();
  40892. if ($previous instanceof \Exception) {
  40893. $e->setPrevious(static::create($previous));
  40894. } elseif ($previous instanceof \Throwable) {
  40895. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  40896. }
  40897. return $e;
  40898. }
  40899. public function toArray()
  40900. {
  40901. $exceptions = array();
  40902. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  40903. $exceptions[] = array(
  40904. 'message' => $exception->getMessage(),
  40905. 'class' => $exception->getClass(),
  40906. 'trace' => $exception->getTrace(),
  40907. );
  40908. }
  40909. return $exceptions;
  40910. }
  40911. public function getStatusCode()
  40912. {
  40913. return $this->statusCode;
  40914. }
  40915. public function setStatusCode($code)
  40916. {
  40917. $this->statusCode = $code;
  40918. }
  40919. public function getHeaders()
  40920. {
  40921. return $this->headers;
  40922. }
  40923. public function setHeaders(array $headers)
  40924. {
  40925. $this->headers = $headers;
  40926. }
  40927. public function getClass()
  40928. {
  40929. return $this->class;
  40930. }
  40931. public function setClass($class)
  40932. {
  40933. $this->class = $class;
  40934. }
  40935. public function getFile()
  40936. {
  40937. return $this->file;
  40938. }
  40939. public function setFile($file)
  40940. {
  40941. $this->file = $file;
  40942. }
  40943. public function getLine()
  40944. {
  40945. return $this->line;
  40946. }
  40947. public function setLine($line)
  40948. {
  40949. $this->line = $line;
  40950. }
  40951. public function getMessage()
  40952. {
  40953. return $this->message;
  40954. }
  40955. public function setMessage($message)
  40956. {
  40957. $this->message = $message;
  40958. }
  40959. public function getCode()
  40960. {
  40961. return $this->code;
  40962. }
  40963. public function setCode($code)
  40964. {
  40965. $this->code = $code;
  40966. }
  40967. public function getPrevious()
  40968. {
  40969. return $this->previous;
  40970. }
  40971. public function setPrevious(FlattenException $previous)
  40972. {
  40973. $this->previous = $previous;
  40974. }
  40975. public function getAllPrevious()
  40976. {
  40977. $exceptions = array();
  40978. $e = $this;
  40979. while ($e = $e->getPrevious()) {
  40980. $exceptions[] = $e;
  40981. }
  40982. return $exceptions;
  40983. }
  40984. public function getTrace()
  40985. {
  40986. return $this->trace;
  40987. }
  40988. public function setTraceFromException(\Exception $exception)
  40989. {
  40990. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  40991. }
  40992. public function setTrace($trace, $file, $line)
  40993. {
  40994. $this->trace = array();
  40995. $this->trace[] = array(
  40996. 'namespace' => '',
  40997. 'short_class' => '',
  40998. 'class' => '',
  40999. 'type' => '',
  41000. 'function' => '',
  41001. 'file' => $file,
  41002. 'line' => $line,
  41003. 'args' => array(),
  41004. );
  41005. foreach ($trace as $entry) {
  41006. $class = '';
  41007. $namespace = '';
  41008. if (isset($entry['class'])) {
  41009. $parts = explode('\\', $entry['class']);
  41010. $class = array_pop($parts);
  41011. $namespace = implode('\\', $parts);
  41012. }
  41013. $this->trace[] = array(
  41014. 'namespace' => $namespace,
  41015. 'short_class' => $class,
  41016. 'class' => isset($entry['class']) ? $entry['class'] : '',
  41017. 'type' => isset($entry['type']) ? $entry['type'] : '',
  41018. 'function' => isset($entry['function']) ? $entry['function'] : null,
  41019. 'file' => isset($entry['file']) ? $entry['file'] : null,
  41020. 'line' => isset($entry['line']) ? $entry['line'] : null,
  41021. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  41022. );
  41023. }
  41024. }
  41025. private function flattenArgs($args, $level = 0, &$count = 0)
  41026. {
  41027. $result = array();
  41028. foreach ($args as $key => $value) {
  41029. if (++$count > 1e4) {
  41030. return array('array', '*SKIPPED over 10000 entries*');
  41031. }
  41032. if ($value instanceof \__PHP_Incomplete_Class) {
  41033. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  41034. } elseif (\is_object($value)) {
  41035. $result[$key] = array('object', \get_class($value));
  41036. } elseif (\is_array($value)) {
  41037. if ($level > 10) {
  41038. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  41039. } else {
  41040. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  41041. }
  41042. } elseif (null === $value) {
  41043. $result[$key] = array('null', null);
  41044. } elseif (\is_bool($value)) {
  41045. $result[$key] = array('boolean', $value);
  41046. } elseif (\is_resource($value)) {
  41047. $result[$key] = array('resource', get_resource_type($value));
  41048. } else {
  41049. $result[$key] = array('string', (string) $value);
  41050. }
  41051. }
  41052. return $result;
  41053. }
  41054. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  41055. {
  41056. $array = new \ArrayObject($value);
  41057. return $array['__PHP_Incomplete_Class_Name'];
  41058. }
  41059. }
  41060. <?php
  41061. namespace Symfony\Component\Debug\Exception;
  41062. class OutOfMemoryException extends FatalErrorException
  41063. {
  41064. }
  41065. <?php
  41066. namespace Symfony\Component\Debug\Exception;
  41067. class UndefinedFunctionException extends FatalErrorException
  41068. {
  41069. public function __construct($message, \ErrorException $previous)
  41070. {
  41071. parent::__construct(
  41072. $message,
  41073. $previous->getCode(),
  41074. $previous->getSeverity(),
  41075. $previous->getFile(),
  41076. $previous->getLine(),
  41077. null,
  41078. true,
  41079. null,
  41080. $previous->getPrevious()
  41081. );
  41082. $this->setTrace($previous->getTrace());
  41083. }
  41084. }
  41085. <?php
  41086. namespace Symfony\Component\Debug\Exception;
  41087. class UndefinedMethodException extends FatalErrorException
  41088. {
  41089. public function __construct($message, \ErrorException $previous)
  41090. {
  41091. parent::__construct(
  41092. $message,
  41093. $previous->getCode(),
  41094. $previous->getSeverity(),
  41095. $previous->getFile(),
  41096. $previous->getLine(),
  41097. null,
  41098. true,
  41099. null,
  41100. $previous->getPrevious()
  41101. );
  41102. $this->setTrace($previous->getTrace());
  41103. }
  41104. }
  41105. <?php
  41106. namespace Symfony\Component\Debug;
  41107. use Symfony\Component\Debug\Exception\FlattenException;
  41108. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  41109. use Symfony\Component\HttpFoundation\Response;
  41110. class ExceptionHandler
  41111. {
  41112. private $debug;
  41113. private $charset;
  41114. private $handler;
  41115. private $caughtBuffer;
  41116. private $caughtLength;
  41117. private $fileLinkFormat;
  41118. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  41119. {
  41120. if (false !== strpos($charset, '%')) {
  41121. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  41122. $pivot = $fileLinkFormat;
  41123. $fileLinkFormat = $charset;
  41124. $charset = $pivot;
  41125. }
  41126. $this->debug = $debug;
  41127. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  41128. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  41129. }
  41130. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  41131. {
  41132. $handler = new static($debug, $charset, $fileLinkFormat);
  41133. $prev = set_exception_handler(array($handler, 'handle'));
  41134. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  41135. restore_exception_handler();
  41136. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  41137. }
  41138. return $handler;
  41139. }
  41140. public function setHandler($handler)
  41141. {
  41142. if (null !== $handler && !\is_callable($handler)) {
  41143. throw new \LogicException('The exception handler must be a valid PHP callable.');
  41144. }
  41145. $old = $this->handler;
  41146. $this->handler = $handler;
  41147. return $old;
  41148. }
  41149. public function setFileLinkFormat($format)
  41150. {
  41151. $old = $this->fileLinkFormat;
  41152. $this->fileLinkFormat = $format;
  41153. return $old;
  41154. }
  41155. public function handle(\Exception $exception)
  41156. {
  41157. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  41158. $this->failSafeHandle($exception);
  41159. return;
  41160. }
  41161. $caughtLength = $this->caughtLength = 0;
  41162. ob_start(array($this, 'catchOutput'));
  41163. $this->failSafeHandle($exception);
  41164. while (null === $this->caughtBuffer && ob_end_flush()) {
  41165. }
  41166. if (isset($this->caughtBuffer[0])) {
  41167. ob_start(array($this, 'cleanOutput'));
  41168. echo $this->caughtBuffer;
  41169. $caughtLength = ob_get_length();
  41170. }
  41171. $this->caughtBuffer = null;
  41172. try {
  41173. \call_user_func($this->handler, $exception);
  41174. $this->caughtLength = $caughtLength;
  41175. } catch (\Exception $e) {
  41176. if (!$caughtLength) {
  41177. throw $exception;
  41178. }
  41179. }
  41180. }
  41181. private function failSafeHandle(\Exception $exception)
  41182. {
  41183. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  41184. && __CLASS__ !== \get_class($this)
  41185. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  41186. && __CLASS__ !== $reflector->class
  41187. ) {
  41188. $response = $this->createResponse($exception);
  41189. $response->sendHeaders();
  41190. $response->sendContent();
  41191. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  41192. return;
  41193. }
  41194. $this->sendPhpResponse($exception);
  41195. }
  41196. public function sendPhpResponse($exception)
  41197. {
  41198. if (!$exception instanceof FlattenException) {
  41199. $exception = FlattenException::create($exception);
  41200. }
  41201. if (!headers_sent()) {
  41202. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  41203. foreach ($exception->getHeaders() as $name => $value) {
  41204. header($name.': '.$value, false);
  41205. }
  41206. header('Content-Type: text/html; charset='.$this->charset);
  41207. }
  41208. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41209. }
  41210. public function createResponse($exception)
  41211. {
  41212. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41213. if (!$exception instanceof FlattenException) {
  41214. $exception = FlattenException::create($exception);
  41215. }
  41216. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  41217. }
  41218. public function getHtml($exception)
  41219. {
  41220. if (!$exception instanceof FlattenException) {
  41221. $exception = FlattenException::create($exception);
  41222. }
  41223. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41224. }
  41225. public function getContent(FlattenException $exception)
  41226. {
  41227. switch ($exception->getStatusCode()) {
  41228. case 404:
  41229. $title = 'Sorry, the page you are looking for could not be found.';
  41230. break;
  41231. default:
  41232. $title = 'Whoops, looks like something went wrong.';
  41233. }
  41234. $content = '';
  41235. if ($this->debug) {
  41236. try {
  41237. $count = \count($exception->getAllPrevious());
  41238. $total = $count + 1;
  41239. foreach ($exception->toArray() as $position => $e) {
  41240. $ind = $count - $position + 1;
  41241. $class = $this->formatClass($e['class']);
  41242. $message = nl2br($this->escapeHtml($e['message']));
  41243. $content .= sprintf(<<<'EOF'
  41244. <h2 class="block_exception clear_fix">
  41245. <span class="exception_counter">%d/%d</span>
  41246. <span class="exception_title">%s%s:</span>
  41247. <span class="exception_message">%s</span>
  41248. </h2>
  41249. <div class="block">
  41250. <ol class="traces list_exception">
  41251. EOF
  41252. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  41253. foreach ($e['trace'] as $trace) {
  41254. $content .= ' <li>';
  41255. if ($trace['function']) {
  41256. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  41257. }
  41258. if (isset($trace['file']) && isset($trace['line'])) {
  41259. $content .= $this->formatPath($trace['file'], $trace['line']);
  41260. }
  41261. $content .= "</li>\n";
  41262. }
  41263. $content .= " </ol>\n</div>\n";
  41264. }
  41265. } catch (\Exception $e) {
  41266. if ($this->debug) {
  41267. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  41268. } else {
  41269. $title = 'Whoops, looks like something went wrong.';
  41270. }
  41271. }
  41272. }
  41273. return <<<EOF
  41274. <div id="sf-resetcontent" class="sf-reset">
  41275. <h1>$title</h1>
  41276. $content
  41277. </div>
  41278. EOF;
  41279. }
  41280. public function getStylesheet(FlattenException $exception)
  41281. {
  41282. return <<<'EOF'
  41283. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  41284. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  41285. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  41286. .sf-reset .clear_fix { display:inline-block; }
  41287. .sf-reset * html .clear_fix { height:1%; }
  41288. .sf-reset .clear_fix { display:block; }
  41289. .sf-reset, .sf-reset .block { margin: auto }
  41290. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  41291. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  41292. .sf-reset strong { font-weight:bold; }
  41293. .sf-reset a { color:#6c6159; cursor: default; }
  41294. .sf-reset a img { border:none; }
  41295. .sf-reset a:hover { text-decoration:underline; }
  41296. .sf-reset em { font-style:italic; }
  41297. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  41298. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  41299. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  41300. .sf-reset .exception_message { margin-left: 3em; display: block; }
  41301. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  41302. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  41303. -webkit-border-bottom-right-radius: 16px;
  41304. -webkit-border-bottom-left-radius: 16px;
  41305. -moz-border-radius-bottomright: 16px;
  41306. -moz-border-radius-bottomleft: 16px;
  41307. border-bottom-right-radius: 16px;
  41308. border-bottom-left-radius: 16px;
  41309. border-bottom:1px solid #ccc;
  41310. border-right:1px solid #ccc;
  41311. border-left:1px solid #ccc;
  41312. word-wrap: break-word;
  41313. }
  41314. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  41315. -webkit-border-top-left-radius: 16px;
  41316. -webkit-border-top-right-radius: 16px;
  41317. -moz-border-radius-topleft: 16px;
  41318. -moz-border-radius-topright: 16px;
  41319. border-top-left-radius: 16px;
  41320. border-top-right-radius: 16px;
  41321. border-top:1px solid #ccc;
  41322. border-right:1px solid #ccc;
  41323. border-left:1px solid #ccc;
  41324. overflow: hidden;
  41325. word-wrap: break-word;
  41326. }
  41327. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  41328. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  41329. .sf-reset ol { padding: 10px 0; }
  41330. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  41331. -webkit-border-radius: 10px;
  41332. -moz-border-radius: 10px;
  41333. border-radius: 10px;
  41334. border: 1px solid #ccc;
  41335. }
  41336. EOF;
  41337. }
  41338. private function decorate($content, $css)
  41339. {
  41340. return <<<EOF
  41341. <!DOCTYPE html>
  41342. <html>
  41343. <head>
  41344. <meta charset="{$this->charset}" />
  41345. <meta name="robots" content="noindex,nofollow" />
  41346. <style>
  41347. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  41348. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  41349. html { background: #eee; padding: 10px }
  41350. img { border: 0; }
  41351. #sf-resetcontent { width:970px; margin:0 auto; }
  41352. $css
  41353. </style>
  41354. </head>
  41355. <body>
  41356. $content
  41357. </body>
  41358. </html>
  41359. EOF;
  41360. }
  41361. private function formatClass($class)
  41362. {
  41363. $parts = explode('\\', $class);
  41364. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  41365. }
  41366. private function formatPath($path, $line)
  41367. {
  41368. $path = $this->escapeHtml($path);
  41369. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  41370. if ($linkFormat = $this->fileLinkFormat) {
  41371. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  41372. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  41373. }
  41374. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  41375. }
  41376. private function formatArgs(array $args)
  41377. {
  41378. $result = array();
  41379. foreach ($args as $key => $item) {
  41380. if ('object' === $item[0]) {
  41381. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  41382. } elseif ('array' === $item[0]) {
  41383. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  41384. } elseif ('string' === $item[0]) {
  41385. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  41386. } elseif ('null' === $item[0]) {
  41387. $formattedValue = '<em>null</em>';
  41388. } elseif ('boolean' === $item[0]) {
  41389. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  41390. } elseif ('resource' === $item[0]) {
  41391. $formattedValue = '<em>resource</em>';
  41392. } else {
  41393. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  41394. }
  41395. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  41396. }
  41397. return implode(', ', $result);
  41398. }
  41399. protected static function utf8Htmlize($str)
  41400. {
  41401. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  41402. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  41403. }
  41404. private function escapeHtml($str)
  41405. {
  41406. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  41407. }
  41408. public function catchOutput($buffer)
  41409. {
  41410. $this->caughtBuffer = $buffer;
  41411. return '';
  41412. }
  41413. public function cleanOutput($buffer)
  41414. {
  41415. if ($this->caughtLength) {
  41416. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  41417. if (isset($cleanBuffer[0])) {
  41418. $buffer = $cleanBuffer;
  41419. }
  41420. }
  41421. return $buffer;
  41422. }
  41423. }
  41424. <?php
  41425. namespace Symfony\Component\Debug\FatalErrorHandler;
  41426. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  41427. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  41428. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  41429. use Symfony\Component\Debug\DebugClassLoader;
  41430. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  41431. use Symfony\Component\Debug\Exception\FatalErrorException;
  41432. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  41433. {
  41434. public function handleError(array $error, FatalErrorException $exception)
  41435. {
  41436. $messageLen = \strlen($error['message']);
  41437. $notFoundSuffix = '\' not found';
  41438. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41439. if ($notFoundSuffixLen > $messageLen) {
  41440. return;
  41441. }
  41442. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41443. return;
  41444. }
  41445. foreach (array('class', 'interface', 'trait') as $typeName) {
  41446. $prefix = ucfirst($typeName).' \'';
  41447. $prefixLen = \strlen($prefix);
  41448. if (0 !== strpos($error['message'], $prefix)) {
  41449. continue;
  41450. }
  41451. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41452. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  41453. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  41454. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  41455. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  41456. $tail = ' for another namespace?';
  41457. } else {
  41458. $className = $fullyQualifiedClassName;
  41459. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  41460. $tail = '?';
  41461. }
  41462. if ($candidates = $this->getClassCandidates($className)) {
  41463. $tail = array_pop($candidates).'"?';
  41464. if ($candidates) {
  41465. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  41466. } else {
  41467. $tail = ' for "'.$tail;
  41468. }
  41469. }
  41470. $message .= "\nDid you forget a \"use\" statement".$tail;
  41471. return new ClassNotFoundException($message, $exception);
  41472. }
  41473. }
  41474. private function getClassCandidates($class)
  41475. {
  41476. if (!\is_array($functions = spl_autoload_functions())) {
  41477. return array();
  41478. }
  41479. $classes = array();
  41480. foreach ($functions as $function) {
  41481. if (!\is_array($function)) {
  41482. continue;
  41483. }
  41484. if ($function[0] instanceof DebugClassLoader) {
  41485. $function = $function[0]->getClassLoader();
  41486. if (\is_object($function)) {
  41487. $function = array($function);
  41488. }
  41489. if (!\is_array($function)) {
  41490. continue;
  41491. }
  41492. }
  41493. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  41494. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  41495. foreach ($paths as $path) {
  41496. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41497. }
  41498. }
  41499. }
  41500. if ($function[0] instanceof ComposerClassLoader) {
  41501. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  41502. foreach ($paths as $path) {
  41503. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41504. }
  41505. }
  41506. }
  41507. }
  41508. return array_unique($classes);
  41509. }
  41510. private function findClassInPath($path, $class, $prefix)
  41511. {
  41512. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  41513. return array();
  41514. }
  41515. $classes = array();
  41516. $filename = $class.'.php';
  41517. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  41518. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  41519. $classes[] = $class;
  41520. }
  41521. }
  41522. return $classes;
  41523. }
  41524. private function convertFileToClass($path, $file, $prefix)
  41525. {
  41526. $candidates = array(
  41527. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  41528. $prefix.$namespacedClass,
  41529. $prefix.'\\'.$namespacedClass,
  41530. str_replace('\\', '_', $namespacedClass),
  41531. str_replace('\\', '_', $prefix.$namespacedClass),
  41532. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  41533. );
  41534. if ($prefix) {
  41535. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  41536. }
  41537. foreach ($candidates as $candidate) {
  41538. if ($this->classExists($candidate)) {
  41539. return $candidate;
  41540. }
  41541. }
  41542. require_once $file;
  41543. foreach ($candidates as $candidate) {
  41544. if ($this->classExists($candidate)) {
  41545. return $candidate;
  41546. }
  41547. }
  41548. }
  41549. private function classExists($class)
  41550. {
  41551. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  41552. }
  41553. }
  41554. <?php
  41555. namespace Symfony\Component\Debug\FatalErrorHandler;
  41556. use Symfony\Component\Debug\Exception\FatalErrorException;
  41557. interface FatalErrorHandlerInterface
  41558. {
  41559. public function handleError(array $error, FatalErrorException $exception);
  41560. }
  41561. <?php
  41562. namespace Symfony\Component\Debug\FatalErrorHandler;
  41563. use Symfony\Component\Debug\Exception\FatalErrorException;
  41564. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  41565. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  41566. {
  41567. public function handleError(array $error, FatalErrorException $exception)
  41568. {
  41569. $messageLen = \strlen($error['message']);
  41570. $notFoundSuffix = '()';
  41571. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41572. if ($notFoundSuffixLen > $messageLen) {
  41573. return;
  41574. }
  41575. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41576. return;
  41577. }
  41578. $prefix = 'Call to undefined function ';
  41579. $prefixLen = \strlen($prefix);
  41580. if (0 !== strpos($error['message'], $prefix)) {
  41581. return;
  41582. }
  41583. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41584. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  41585. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  41586. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  41587. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  41588. } else {
  41589. $functionName = $fullyQualifiedFunctionName;
  41590. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  41591. }
  41592. $candidates = array();
  41593. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  41594. foreach ($definedFunctionNames as $definedFunctionName) {
  41595. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  41596. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  41597. } else {
  41598. $definedFunctionNameBasename = $definedFunctionName;
  41599. }
  41600. if ($definedFunctionNameBasename === $functionName) {
  41601. $candidates[] = '\\'.$definedFunctionName;
  41602. }
  41603. }
  41604. }
  41605. if ($candidates) {
  41606. sort($candidates);
  41607. $last = array_pop($candidates).'"?';
  41608. if ($candidates) {
  41609. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41610. } else {
  41611. $candidates = '"'.$last;
  41612. }
  41613. $message .= "\nDid you mean to call ".$candidates;
  41614. }
  41615. return new UndefinedFunctionException($message, $exception);
  41616. }
  41617. }
  41618. <?php
  41619. namespace Symfony\Component\Debug\FatalErrorHandler;
  41620. use Symfony\Component\Debug\Exception\FatalErrorException;
  41621. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  41622. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  41623. {
  41624. public function handleError(array $error, FatalErrorException $exception)
  41625. {
  41626. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  41627. if (!$matches) {
  41628. return;
  41629. }
  41630. $className = $matches[1];
  41631. $methodName = $matches[2];
  41632. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  41633. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  41634. return new UndefinedMethodException($message, $exception);
  41635. }
  41636. $candidates = array();
  41637. foreach ($methods as $definedMethodName) {
  41638. $lev = levenshtein($methodName, $definedMethodName);
  41639. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  41640. $candidates[] = $definedMethodName;
  41641. }
  41642. }
  41643. if ($candidates) {
  41644. sort($candidates);
  41645. $last = array_pop($candidates).'"?';
  41646. if ($candidates) {
  41647. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41648. } else {
  41649. $candidates = '"'.$last;
  41650. }
  41651. $message .= "\nDid you mean to call ".$candidates;
  41652. }
  41653. return new UndefinedMethodException($message, $exception);
  41654. }
  41655. }
  41656. Copyright (c) 2004-2018 Fabien Potencier
  41657. Permission is hereby granted, free of charge, to any person obtaining a copy
  41658. of this software and associated documentation files (the "Software"), to deal
  41659. in the Software without restriction, including without limitation the rights
  41660. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41661. copies of the Software, and to permit persons to whom the Software is furnished
  41662. to do so, subject to the following conditions:
  41663. The above copyright notice and this permission notice shall be included in all
  41664. copies or substantial portions of the Software.
  41665. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41666. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41667. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41668. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41669. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41670. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41671. THE SOFTWARE.
  41672. <?php
  41673. namespace Symfony\Component\Filesystem\Exception;
  41674. interface ExceptionInterface
  41675. {
  41676. }
  41677. <?php
  41678. namespace Symfony\Component\Filesystem\Exception;
  41679. class FileNotFoundException extends IOException
  41680. {
  41681. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  41682. {
  41683. if (null === $message) {
  41684. if (null === $path) {
  41685. $message = 'File could not be found.';
  41686. } else {
  41687. $message = sprintf('File "%s" could not be found.', $path);
  41688. }
  41689. }
  41690. parent::__construct($message, $code, $previous, $path);
  41691. }
  41692. }
  41693. <?php
  41694. namespace Symfony\Component\Filesystem\Exception;
  41695. class IOException extends \RuntimeException implements IOExceptionInterface
  41696. {
  41697. private $path;
  41698. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  41699. {
  41700. $this->path = $path;
  41701. parent::__construct($message, $code, $previous);
  41702. }
  41703. public function getPath()
  41704. {
  41705. return $this->path;
  41706. }
  41707. }
  41708. <?php
  41709. namespace Symfony\Component\Filesystem\Exception;
  41710. interface IOExceptionInterface extends ExceptionInterface
  41711. {
  41712. public function getPath();
  41713. }
  41714. <?php
  41715. namespace Symfony\Component\Filesystem;
  41716. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  41717. use Symfony\Component\Filesystem\Exception\IOException;
  41718. class Filesystem
  41719. {
  41720. private static $lastError;
  41721. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  41722. {
  41723. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  41724. if ($originIsLocal && !is_file($originFile)) {
  41725. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  41726. }
  41727. $this->mkdir(\dirname($targetFile));
  41728. $doCopy = true;
  41729. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  41730. $doCopy = filemtime($originFile) > filemtime($targetFile);
  41731. }
  41732. if ($doCopy) {
  41733. if (false === $source = @fopen($originFile, 'r')) {
  41734. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  41735. }
  41736. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  41737. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  41738. }
  41739. $bytesCopied = stream_copy_to_stream($source, $target);
  41740. fclose($source);
  41741. fclose($target);
  41742. unset($source, $target);
  41743. if (!is_file($targetFile)) {
  41744. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  41745. }
  41746. if ($originIsLocal) {
  41747. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  41748. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  41749. 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);
  41750. }
  41751. }
  41752. }
  41753. }
  41754. public function mkdir($dirs, $mode = 0777)
  41755. {
  41756. foreach ($this->toIterator($dirs) as $dir) {
  41757. if (is_dir($dir)) {
  41758. continue;
  41759. }
  41760. if (!self::box('mkdir', $dir, $mode, true)) {
  41761. if (!is_dir($dir)) {
  41762. if (self::$lastError) {
  41763. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  41764. }
  41765. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  41766. }
  41767. }
  41768. }
  41769. }
  41770. public function exists($files)
  41771. {
  41772. $maxPathLength = PHP_MAXPATHLEN - 2;
  41773. foreach ($this->toIterator($files) as $file) {
  41774. if (\strlen($file) > $maxPathLength) {
  41775. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  41776. }
  41777. if (!file_exists($file)) {
  41778. return false;
  41779. }
  41780. }
  41781. return true;
  41782. }
  41783. public function touch($files, $time = null, $atime = null)
  41784. {
  41785. foreach ($this->toIterator($files) as $file) {
  41786. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  41787. if (true !== $touch) {
  41788. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  41789. }
  41790. }
  41791. }
  41792. public function remove($files)
  41793. {
  41794. if ($files instanceof \Traversable) {
  41795. $files = iterator_to_array($files, false);
  41796. } elseif (!\is_array($files)) {
  41797. $files = array($files);
  41798. }
  41799. $files = array_reverse($files);
  41800. foreach ($files as $file) {
  41801. if (is_link($file)) {
  41802. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  41803. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  41804. }
  41805. } elseif (is_dir($file)) {
  41806. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  41807. if (!self::box('rmdir', $file) && file_exists($file)) {
  41808. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  41809. }
  41810. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  41811. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  41812. }
  41813. }
  41814. }
  41815. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  41816. {
  41817. foreach ($this->toIterator($files) as $file) {
  41818. if (true !== @chmod($file, $mode & ~$umask)) {
  41819. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  41820. }
  41821. if ($recursive && is_dir($file) && !is_link($file)) {
  41822. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  41823. }
  41824. }
  41825. }
  41826. public function chown($files, $user, $recursive = false)
  41827. {
  41828. foreach ($this->toIterator($files) as $file) {
  41829. if ($recursive && is_dir($file) && !is_link($file)) {
  41830. $this->chown(new \FilesystemIterator($file), $user, true);
  41831. }
  41832. if (is_link($file) && \function_exists('lchown')) {
  41833. if (true !== @lchown($file, $user)) {
  41834. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41835. }
  41836. } else {
  41837. if (true !== @chown($file, $user)) {
  41838. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41839. }
  41840. }
  41841. }
  41842. }
  41843. public function chgrp($files, $group, $recursive = false)
  41844. {
  41845. foreach ($this->toIterator($files) as $file) {
  41846. if ($recursive && is_dir($file) && !is_link($file)) {
  41847. $this->chgrp(new \FilesystemIterator($file), $group, true);
  41848. }
  41849. if (is_link($file) && \function_exists('lchgrp')) {
  41850. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  41851. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41852. }
  41853. } else {
  41854. if (true !== @chgrp($file, $group)) {
  41855. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41856. }
  41857. }
  41858. }
  41859. }
  41860. public function rename($origin, $target, $overwrite = false)
  41861. {
  41862. if (!$overwrite && $this->isReadable($target)) {
  41863. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  41864. }
  41865. if (true !== @rename($origin, $target)) {
  41866. if (is_dir($origin)) {
  41867. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  41868. $this->remove($origin);
  41869. return;
  41870. }
  41871. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  41872. }
  41873. }
  41874. private function isReadable($filename)
  41875. {
  41876. $maxPathLength = PHP_MAXPATHLEN - 2;
  41877. if (\strlen($filename) > $maxPathLength) {
  41878. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  41879. }
  41880. return is_readable($filename);
  41881. }
  41882. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  41883. {
  41884. if ('\\' === \DIRECTORY_SEPARATOR) {
  41885. $originDir = strtr($originDir, '/', '\\');
  41886. $targetDir = strtr($targetDir, '/', '\\');
  41887. if ($copyOnWindows) {
  41888. $this->mirror($originDir, $targetDir);
  41889. return;
  41890. }
  41891. }
  41892. $this->mkdir(\dirname($targetDir));
  41893. if (is_link($targetDir)) {
  41894. if (readlink($targetDir) === $originDir) {
  41895. return;
  41896. }
  41897. $this->remove($targetDir);
  41898. }
  41899. if (!self::box('symlink', $originDir, $targetDir)) {
  41900. if (null !== self::$lastError) {
  41901. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  41902. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  41903. }
  41904. }
  41905. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  41906. }
  41907. }
  41908. public function makePathRelative($endPath, $startPath)
  41909. {
  41910. if ('\\' === \DIRECTORY_SEPARATOR) {
  41911. $endPath = str_replace('\\', '/', $endPath);
  41912. $startPath = str_replace('\\', '/', $startPath);
  41913. }
  41914. $stripDriveLetter = function ($path) {
  41915. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  41916. return substr($path, 2);
  41917. }
  41918. return $path;
  41919. };
  41920. $endPath = $stripDriveLetter($endPath);
  41921. $startPath = $stripDriveLetter($startPath);
  41922. $startPathArr = explode('/', trim($startPath, '/'));
  41923. $endPathArr = explode('/', trim($endPath, '/'));
  41924. $normalizePathArray = function ($pathSegments, $absolute) {
  41925. $result = array();
  41926. foreach ($pathSegments as $segment) {
  41927. if ('..' === $segment && ($absolute || \count($result))) {
  41928. array_pop($result);
  41929. } elseif ('.' !== $segment) {
  41930. $result[] = $segment;
  41931. }
  41932. }
  41933. return $result;
  41934. };
  41935. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  41936. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  41937. $index = 0;
  41938. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  41939. ++$index;
  41940. }
  41941. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  41942. $depth = 0;
  41943. } else {
  41944. $depth = \count($startPathArr) - $index;
  41945. }
  41946. $traverser = str_repeat('../', $depth);
  41947. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  41948. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  41949. return '' === $relativePath ? './' : $relativePath;
  41950. }
  41951. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  41952. {
  41953. $targetDir = rtrim($targetDir, '/\\');
  41954. $originDir = rtrim($originDir, '/\\');
  41955. $originDirLen = \strlen($originDir);
  41956. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  41957. $deleteIterator = $iterator;
  41958. if (null === $deleteIterator) {
  41959. $flags = \FilesystemIterator::SKIP_DOTS;
  41960. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  41961. }
  41962. $targetDirLen = \strlen($targetDir);
  41963. foreach ($deleteIterator as $file) {
  41964. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  41965. if (!$this->exists($origin)) {
  41966. $this->remove($file);
  41967. }
  41968. }
  41969. }
  41970. $copyOnWindows = false;
  41971. if (isset($options['copy_on_windows'])) {
  41972. $copyOnWindows = $options['copy_on_windows'];
  41973. }
  41974. if (null === $iterator) {
  41975. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  41976. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  41977. }
  41978. if ($this->exists($originDir)) {
  41979. $this->mkdir($targetDir);
  41980. }
  41981. foreach ($iterator as $file) {
  41982. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  41983. if ($copyOnWindows) {
  41984. if (is_file($file)) {
  41985. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41986. } elseif (is_dir($file)) {
  41987. $this->mkdir($target);
  41988. } else {
  41989. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  41990. }
  41991. } else {
  41992. if (is_link($file)) {
  41993. $this->symlink($file->getLinkTarget(), $target);
  41994. } elseif (is_dir($file)) {
  41995. $this->mkdir($target);
  41996. } elseif (is_file($file)) {
  41997. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41998. } else {
  41999. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  42000. }
  42001. }
  42002. }
  42003. }
  42004. public function isAbsolutePath($file)
  42005. {
  42006. return strspn($file, '/\\', 0, 1)
  42007. || (\strlen($file) > 3 && ctype_alpha($file[0])
  42008. && ':' === substr($file, 1, 1)
  42009. && strspn($file, '/\\', 2, 1)
  42010. )
  42011. || null !== parse_url($file, PHP_URL_SCHEME)
  42012. ;
  42013. }
  42014. public function tempnam($dir, $prefix)
  42015. {
  42016. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  42017. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  42018. $tmpFile = @tempnam($hierarchy, $prefix);
  42019. if (false !== $tmpFile) {
  42020. if (null !== $scheme && 'gs' !== $scheme) {
  42021. return $scheme.'://'.$tmpFile;
  42022. }
  42023. return $tmpFile;
  42024. }
  42025. throw new IOException('A temporary file could not be created.');
  42026. }
  42027. for ($i = 0; $i < 10; ++$i) {
  42028. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  42029. $handle = @fopen($tmpFile, 'x+');
  42030. if (false === $handle) {
  42031. continue;
  42032. }
  42033. @fclose($handle);
  42034. return $tmpFile;
  42035. }
  42036. throw new IOException('A temporary file could not be created.');
  42037. }
  42038. public function dumpFile($filename, $content, $mode = 0666)
  42039. {
  42040. $dir = \dirname($filename);
  42041. if (!is_dir($dir)) {
  42042. $this->mkdir($dir);
  42043. }
  42044. if (!is_writable($dir)) {
  42045. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  42046. }
  42047. $tmpFile = $this->tempnam($dir, basename($filename));
  42048. if (false === @file_put_contents($tmpFile, $content)) {
  42049. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  42050. }
  42051. if (null !== $mode) {
  42052. if (\func_num_args() > 2) {
  42053. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  42054. }
  42055. $this->chmod($tmpFile, $mode);
  42056. } elseif (file_exists($filename)) {
  42057. @chmod($tmpFile, fileperms($filename));
  42058. }
  42059. $this->rename($tmpFile, $filename, true);
  42060. }
  42061. private function toIterator($files)
  42062. {
  42063. if (!$files instanceof \Traversable) {
  42064. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  42065. }
  42066. return $files;
  42067. }
  42068. private function getSchemeAndHierarchy($filename)
  42069. {
  42070. $components = explode('://', $filename, 2);
  42071. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  42072. }
  42073. private static function box($func)
  42074. {
  42075. self::$lastError = null;
  42076. \set_error_handler(__CLASS__.'::handleError');
  42077. try {
  42078. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  42079. \restore_error_handler();
  42080. return $result;
  42081. } catch (\Throwable $e) {
  42082. } catch (\Exception $e) {
  42083. }
  42084. \restore_error_handler();
  42085. throw $e;
  42086. }
  42087. public static function handleError($type, $msg)
  42088. {
  42089. self::$lastError = $msg;
  42090. }
  42091. }
  42092. Copyright (c) 2004-2018 Fabien Potencier
  42093. Permission is hereby granted, free of charge, to any person obtaining a copy
  42094. of this software and associated documentation files (the "Software"), to deal
  42095. in the Software without restriction, including without limitation the rights
  42096. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42097. copies of the Software, and to permit persons to whom the Software is furnished
  42098. to do so, subject to the following conditions:
  42099. The above copyright notice and this permission notice shall be included in all
  42100. copies or substantial portions of the Software.
  42101. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42102. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42103. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42104. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42105. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42106. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42107. THE SOFTWARE.
  42108. <?php
  42109. namespace Symfony\Component\Filesystem;
  42110. use Symfony\Component\Filesystem\Exception\IOException;
  42111. class LockHandler
  42112. {
  42113. private $file;
  42114. private $handle;
  42115. public function __construct($name, $lockPath = null)
  42116. {
  42117. $lockPath = $lockPath ?: sys_get_temp_dir();
  42118. if (!is_dir($lockPath)) {
  42119. $fs = new Filesystem();
  42120. $fs->mkdir($lockPath);
  42121. }
  42122. if (!is_writable($lockPath)) {
  42123. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  42124. }
  42125. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  42126. }
  42127. public function lock($blocking = false)
  42128. {
  42129. if ($this->handle) {
  42130. return true;
  42131. }
  42132. $error = null;
  42133. set_error_handler(function ($errno, $msg) use (&$error) {
  42134. $error = $msg;
  42135. });
  42136. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42137. if ($this->handle = fopen($this->file, 'x')) {
  42138. chmod($this->file, 0666);
  42139. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42140. usleep(100);
  42141. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  42142. }
  42143. }
  42144. restore_error_handler();
  42145. if (!$this->handle) {
  42146. throw new IOException($error, 0, null, $this->file);
  42147. }
  42148. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  42149. fclose($this->handle);
  42150. $this->handle = null;
  42151. return false;
  42152. }
  42153. return true;
  42154. }
  42155. public function release()
  42156. {
  42157. if ($this->handle) {
  42158. flock($this->handle, LOCK_UN | LOCK_NB);
  42159. fclose($this->handle);
  42160. $this->handle = null;
  42161. }
  42162. }
  42163. }
  42164. <?php
  42165. namespace Symfony\Component\Finder\Adapter;
  42166. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42167. abstract class AbstractAdapter implements AdapterInterface
  42168. {
  42169. protected $followLinks = false;
  42170. protected $mode = 0;
  42171. protected $minDepth = 0;
  42172. protected $maxDepth = PHP_INT_MAX;
  42173. protected $exclude = array();
  42174. protected $names = array();
  42175. protected $notNames = array();
  42176. protected $contains = array();
  42177. protected $notContains = array();
  42178. protected $sizes = array();
  42179. protected $dates = array();
  42180. protected $filters = array();
  42181. protected $sort = false;
  42182. protected $paths = array();
  42183. protected $notPaths = array();
  42184. protected $ignoreUnreadableDirs = false;
  42185. private static $areSupported = array();
  42186. public function isSupported()
  42187. {
  42188. $name = $this->getName();
  42189. if (!array_key_exists($name, self::$areSupported)) {
  42190. self::$areSupported[$name] = $this->canBeUsed();
  42191. }
  42192. return self::$areSupported[$name];
  42193. }
  42194. public function setFollowLinks($followLinks)
  42195. {
  42196. $this->followLinks = $followLinks;
  42197. return $this;
  42198. }
  42199. public function setMode($mode)
  42200. {
  42201. $this->mode = $mode;
  42202. return $this;
  42203. }
  42204. public function setDepths(array $depths)
  42205. {
  42206. $this->minDepth = 0;
  42207. $this->maxDepth = PHP_INT_MAX;
  42208. foreach ($depths as $comparator) {
  42209. switch ($comparator->getOperator()) {
  42210. case '>':
  42211. $this->minDepth = $comparator->getTarget() + 1;
  42212. break;
  42213. case '>=':
  42214. $this->minDepth = $comparator->getTarget();
  42215. break;
  42216. case '<':
  42217. $this->maxDepth = $comparator->getTarget() - 1;
  42218. break;
  42219. case '<=':
  42220. $this->maxDepth = $comparator->getTarget();
  42221. break;
  42222. default:
  42223. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  42224. }
  42225. }
  42226. return $this;
  42227. }
  42228. public function setExclude(array $exclude)
  42229. {
  42230. $this->exclude = $exclude;
  42231. return $this;
  42232. }
  42233. public function setNames(array $names)
  42234. {
  42235. $this->names = $names;
  42236. return $this;
  42237. }
  42238. public function setNotNames(array $notNames)
  42239. {
  42240. $this->notNames = $notNames;
  42241. return $this;
  42242. }
  42243. public function setContains(array $contains)
  42244. {
  42245. $this->contains = $contains;
  42246. return $this;
  42247. }
  42248. public function setNotContains(array $notContains)
  42249. {
  42250. $this->notContains = $notContains;
  42251. return $this;
  42252. }
  42253. public function setSizes(array $sizes)
  42254. {
  42255. $this->sizes = $sizes;
  42256. return $this;
  42257. }
  42258. public function setDates(array $dates)
  42259. {
  42260. $this->dates = $dates;
  42261. return $this;
  42262. }
  42263. public function setFilters(array $filters)
  42264. {
  42265. $this->filters = $filters;
  42266. return $this;
  42267. }
  42268. public function setSort($sort)
  42269. {
  42270. $this->sort = $sort;
  42271. return $this;
  42272. }
  42273. public function setPath(array $paths)
  42274. {
  42275. $this->paths = $paths;
  42276. return $this;
  42277. }
  42278. public function setNotPath(array $notPaths)
  42279. {
  42280. $this->notPaths = $notPaths;
  42281. return $this;
  42282. }
  42283. public function ignoreUnreadableDirs($ignore = true)
  42284. {
  42285. $this->ignoreUnreadableDirs = (bool) $ignore;
  42286. return $this;
  42287. }
  42288. abstract protected function canBeUsed();
  42289. }
  42290. <?php
  42291. namespace Symfony\Component\Finder\Adapter;
  42292. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42293. use Symfony\Component\Finder\Comparator\DateComparator;
  42294. use Symfony\Component\Finder\Comparator\NumberComparator;
  42295. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42296. use Symfony\Component\Finder\Expression\Expression;
  42297. use Symfony\Component\Finder\Iterator;
  42298. use Symfony\Component\Finder\Shell\Command;
  42299. use Symfony\Component\Finder\Shell\Shell;
  42300. abstract class AbstractFindAdapter extends AbstractAdapter
  42301. {
  42302. protected $shell;
  42303. public function __construct()
  42304. {
  42305. $this->shell = new Shell();
  42306. }
  42307. public function searchInDirectory($dir)
  42308. {
  42309. $dir = realpath($dir);
  42310. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  42311. return new Iterator\FilePathsIterator(array(), $dir);
  42312. }
  42313. $command = Command::create();
  42314. $find = $this->buildFindCommand($command, $dir);
  42315. if ($this->followLinks) {
  42316. $find->add('-follow');
  42317. }
  42318. $find->add('-mindepth')->add($this->minDepth + 1);
  42319. if (PHP_INT_MAX !== $this->maxDepth) {
  42320. $find->add('-maxdepth')->add($this->maxDepth + 1);
  42321. }
  42322. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  42323. $find->add('-type d');
  42324. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  42325. $find->add('-type f');
  42326. }
  42327. $this->buildNamesFiltering($find, $this->names);
  42328. $this->buildNamesFiltering($find, $this->notNames, true);
  42329. $this->buildPathsFiltering($find, $dir, $this->paths);
  42330. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  42331. $this->buildSizesFiltering($find, $this->sizes);
  42332. $this->buildDatesFiltering($find, $this->dates);
  42333. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  42334. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  42335. if ($useGrep && ($this->contains || $this->notContains)) {
  42336. $grep = $command->ins('grep');
  42337. $this->buildContentFiltering($grep, $this->contains);
  42338. $this->buildContentFiltering($grep, $this->notContains, true);
  42339. }
  42340. if ($useSort) {
  42341. $this->buildSorting($command, $this->sort);
  42342. }
  42343. $command->setErrorHandler(
  42344. $this->ignoreUnreadableDirs
  42345. ? function ($stderr) { }
  42346. : function ($stderr) { throw new AccessDeniedException($stderr); }
  42347. );
  42348. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  42349. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  42350. if ($this->exclude) {
  42351. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42352. }
  42353. if (!$useGrep && ($this->contains || $this->notContains)) {
  42354. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42355. }
  42356. if ($this->filters) {
  42357. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42358. }
  42359. if (!$useSort && $this->sort) {
  42360. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42361. $iterator = $iteratorAggregate->getIterator();
  42362. }
  42363. return $iterator;
  42364. }
  42365. protected function canBeUsed()
  42366. {
  42367. return $this->shell->testCommand('find');
  42368. }
  42369. protected function buildFindCommand(Command $command, $dir)
  42370. {
  42371. return $command
  42372. ->ins('find')
  42373. ->add('find ')
  42374. ->arg($dir)
  42375. ->add('-noleaf');
  42376. }
  42377. private function buildNamesFiltering(Command $command, array $names, $not = false)
  42378. {
  42379. if (0 === \count($names)) {
  42380. return;
  42381. }
  42382. $command->add($not ? '-not' : null)->cmd('(');
  42383. foreach ($names as $i => $name) {
  42384. $expr = Expression::create($name);
  42385. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42386. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42387. }
  42388. if ($expr->isRegex()) {
  42389. $regex = $expr->getRegex();
  42390. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  42391. ->setStartFlag(false)
  42392. ->setStartJoker(true)
  42393. ->replaceJokers('[^/]');
  42394. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  42395. $regex->setEndJoker(false)->append('[^/]*');
  42396. }
  42397. }
  42398. $command
  42399. ->add($i > 0 ? '-or' : null)
  42400. ->add($expr->isRegex()
  42401. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42402. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  42403. )
  42404. ->arg($expr->renderPattern());
  42405. }
  42406. $command->cmd(')');
  42407. }
  42408. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  42409. {
  42410. if (0 === \count($paths)) {
  42411. return;
  42412. }
  42413. $command->add($not ? '-not' : null)->cmd('(');
  42414. foreach ($paths as $i => $path) {
  42415. $expr = Expression::create($path);
  42416. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42417. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42418. }
  42419. if ($expr->isRegex()) {
  42420. $regex = $expr->getRegex();
  42421. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  42422. } else {
  42423. $expr->prepend('*')->append('*');
  42424. }
  42425. $command
  42426. ->add($i > 0 ? '-or' : null)
  42427. ->add($expr->isRegex()
  42428. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42429. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  42430. )
  42431. ->arg($expr->renderPattern());
  42432. }
  42433. $command->cmd(')');
  42434. }
  42435. private function buildSizesFiltering(Command $command, array $sizes)
  42436. {
  42437. foreach ($sizes as $i => $size) {
  42438. $command->add($i > 0 ? '-and' : null);
  42439. switch ($size->getOperator()) {
  42440. case '<=':
  42441. $command->add('-size -'.($size->getTarget() + 1).'c');
  42442. break;
  42443. case '>=':
  42444. $command->add('-size +'.($size->getTarget() - 1).'c');
  42445. break;
  42446. case '>':
  42447. $command->add('-size +'.$size->getTarget().'c');
  42448. break;
  42449. case '!=':
  42450. $command->add('-size -'.$size->getTarget().'c');
  42451. $command->add('-size +'.$size->getTarget().'c');
  42452. break;
  42453. case '<':
  42454. default:
  42455. $command->add('-size -'.$size->getTarget().'c');
  42456. }
  42457. }
  42458. }
  42459. private function buildDatesFiltering(Command $command, array $dates)
  42460. {
  42461. foreach ($dates as $i => $date) {
  42462. $command->add($i > 0 ? '-and' : null);
  42463. $mins = (int) round((time() - $date->getTarget()) / 60);
  42464. if (0 > $mins) {
  42465. $command->add(' -mmin -0');
  42466. return;
  42467. }
  42468. switch ($date->getOperator()) {
  42469. case '<=':
  42470. $command->add('-mmin +'.($mins - 1));
  42471. break;
  42472. case '>=':
  42473. $command->add('-mmin -'.($mins + 1));
  42474. break;
  42475. case '>':
  42476. $command->add('-mmin -'.$mins);
  42477. break;
  42478. case '!=':
  42479. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  42480. break;
  42481. case '<':
  42482. default:
  42483. $command->add('-mmin +'.$mins);
  42484. }
  42485. }
  42486. }
  42487. private function buildSorting(Command $command, $sort)
  42488. {
  42489. $this->buildFormatSorting($command, $sort);
  42490. }
  42491. abstract protected function buildFormatSorting(Command $command, $sort);
  42492. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  42493. }
  42494. <?php
  42495. namespace Symfony\Component\Finder\Adapter;
  42496. interface AdapterInterface
  42497. {
  42498. public function setFollowLinks($followLinks);
  42499. public function setMode($mode);
  42500. public function setExclude(array $exclude);
  42501. public function setDepths(array $depths);
  42502. public function setNames(array $names);
  42503. public function setNotNames(array $notNames);
  42504. public function setContains(array $contains);
  42505. public function setNotContains(array $notContains);
  42506. public function setSizes(array $sizes);
  42507. public function setDates(array $dates);
  42508. public function setFilters(array $filters);
  42509. public function setSort($sort);
  42510. public function setPath(array $paths);
  42511. public function setNotPath(array $notPaths);
  42512. public function ignoreUnreadableDirs($ignore = true);
  42513. public function searchInDirectory($dir);
  42514. public function isSupported();
  42515. public function getName();
  42516. }
  42517. <?php
  42518. namespace Symfony\Component\Finder\Adapter;
  42519. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42520. use Symfony\Component\Finder\Expression\Expression;
  42521. use Symfony\Component\Finder\Iterator\SortableIterator;
  42522. use Symfony\Component\Finder\Shell\Command;
  42523. use Symfony\Component\Finder\Shell\Shell;
  42524. class BsdFindAdapter extends AbstractFindAdapter
  42525. {
  42526. public function getName()
  42527. {
  42528. return 'bsd_find';
  42529. }
  42530. protected function canBeUsed()
  42531. {
  42532. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  42533. }
  42534. protected function buildFormatSorting(Command $command, $sort)
  42535. {
  42536. switch ($sort) {
  42537. case SortableIterator::SORT_BY_NAME:
  42538. $command->ins('sort')->add('| sort');
  42539. return;
  42540. case SortableIterator::SORT_BY_TYPE:
  42541. $format = '%HT';
  42542. break;
  42543. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42544. $format = '%a';
  42545. break;
  42546. case SortableIterator::SORT_BY_CHANGED_TIME:
  42547. $format = '%c';
  42548. break;
  42549. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42550. $format = '%m';
  42551. break;
  42552. default:
  42553. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42554. }
  42555. $command
  42556. ->add('-print0 | xargs -0 stat -f')
  42557. ->arg($format.'%t%N')
  42558. ->add('| sort | cut -f 2');
  42559. }
  42560. protected function buildFindCommand(Command $command, $dir)
  42561. {
  42562. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  42563. return $command;
  42564. }
  42565. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42566. {
  42567. foreach ($contains as $contain) {
  42568. $expr = Expression::create($contain);
  42569. $command
  42570. ->add('| grep -v \'^$\'')
  42571. ->add('| xargs -I{} grep -I')
  42572. ->add($expr->isCaseSensitive() ? null : '-i')
  42573. ->add($not ? '-L' : '-l')
  42574. ->add('-Ee')->arg($expr->renderPattern())
  42575. ->add('{}')
  42576. ;
  42577. }
  42578. }
  42579. }
  42580. <?php
  42581. namespace Symfony\Component\Finder\Adapter;
  42582. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42583. use Symfony\Component\Finder\Expression\Expression;
  42584. use Symfony\Component\Finder\Iterator\SortableIterator;
  42585. use Symfony\Component\Finder\Shell\Command;
  42586. use Symfony\Component\Finder\Shell\Shell;
  42587. class GnuFindAdapter extends AbstractFindAdapter
  42588. {
  42589. public function getName()
  42590. {
  42591. return 'gnu_find';
  42592. }
  42593. protected function buildFormatSorting(Command $command, $sort)
  42594. {
  42595. switch ($sort) {
  42596. case SortableIterator::SORT_BY_NAME:
  42597. $command->ins('sort')->add('| sort');
  42598. return;
  42599. case SortableIterator::SORT_BY_TYPE:
  42600. $format = '%y';
  42601. break;
  42602. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42603. $format = '%A@';
  42604. break;
  42605. case SortableIterator::SORT_BY_CHANGED_TIME:
  42606. $format = '%C@';
  42607. break;
  42608. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42609. $format = '%T@';
  42610. break;
  42611. default:
  42612. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42613. }
  42614. $command
  42615. ->get('find')
  42616. ->add('-printf')
  42617. ->arg($format.' %h/%f\\n')
  42618. ->add('| sort | cut')
  42619. ->arg('-d ')
  42620. ->arg('-f2-')
  42621. ;
  42622. }
  42623. protected function canBeUsed()
  42624. {
  42625. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  42626. }
  42627. protected function buildFindCommand(Command $command, $dir)
  42628. {
  42629. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  42630. }
  42631. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42632. {
  42633. foreach ($contains as $contain) {
  42634. $expr = Expression::create($contain);
  42635. $command
  42636. ->add('| xargs -I{} -r grep -I')
  42637. ->add($expr->isCaseSensitive() ? null : '-i')
  42638. ->add($not ? '-L' : '-l')
  42639. ->add('-Ee')->arg($expr->renderPattern())
  42640. ->add('{}')
  42641. ;
  42642. }
  42643. }
  42644. }
  42645. <?php
  42646. namespace Symfony\Component\Finder\Adapter;
  42647. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42648. use Symfony\Component\Finder\Iterator;
  42649. class PhpAdapter extends AbstractAdapter
  42650. {
  42651. public function searchInDirectory($dir)
  42652. {
  42653. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42654. if ($this->followLinks) {
  42655. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42656. }
  42657. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42658. if ($this->exclude) {
  42659. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42660. }
  42661. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42662. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  42663. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  42664. }
  42665. if ($this->mode) {
  42666. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42667. }
  42668. if ($this->names || $this->notNames) {
  42669. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42670. }
  42671. if ($this->contains || $this->notContains) {
  42672. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42673. }
  42674. if ($this->sizes) {
  42675. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42676. }
  42677. if ($this->dates) {
  42678. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42679. }
  42680. if ($this->filters) {
  42681. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42682. }
  42683. if ($this->paths || $this->notPaths) {
  42684. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42685. }
  42686. if ($this->sort) {
  42687. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42688. $iterator = $iteratorAggregate->getIterator();
  42689. }
  42690. return $iterator;
  42691. }
  42692. public function getName()
  42693. {
  42694. return 'php';
  42695. }
  42696. protected function canBeUsed()
  42697. {
  42698. return true;
  42699. }
  42700. }
  42701. <?php
  42702. namespace Symfony\Component\Finder\Comparator;
  42703. class Comparator
  42704. {
  42705. private $target;
  42706. private $operator = '==';
  42707. public function getTarget()
  42708. {
  42709. return $this->target;
  42710. }
  42711. public function setTarget($target)
  42712. {
  42713. $this->target = $target;
  42714. }
  42715. public function getOperator()
  42716. {
  42717. return $this->operator;
  42718. }
  42719. public function setOperator($operator)
  42720. {
  42721. if (!$operator) {
  42722. $operator = '==';
  42723. }
  42724. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  42725. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  42726. }
  42727. $this->operator = $operator;
  42728. }
  42729. public function test($test)
  42730. {
  42731. switch ($this->operator) {
  42732. case '>':
  42733. return $test > $this->target;
  42734. case '>=':
  42735. return $test >= $this->target;
  42736. case '<':
  42737. return $test < $this->target;
  42738. case '<=':
  42739. return $test <= $this->target;
  42740. case '!=':
  42741. return $test != $this->target;
  42742. }
  42743. return $test == $this->target;
  42744. }
  42745. }
  42746. <?php
  42747. namespace Symfony\Component\Finder\Comparator;
  42748. class DateComparator extends Comparator
  42749. {
  42750. public function __construct($test)
  42751. {
  42752. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  42753. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  42754. }
  42755. try {
  42756. $date = new \DateTime($matches[2]);
  42757. $target = $date->format('U');
  42758. } catch (\Exception $e) {
  42759. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  42760. }
  42761. $operator = isset($matches[1]) ? $matches[1] : '==';
  42762. if ('since' === $operator || 'after' === $operator) {
  42763. $operator = '>';
  42764. }
  42765. if ('until' === $operator || 'before' === $operator) {
  42766. $operator = '<';
  42767. }
  42768. $this->setOperator($operator);
  42769. $this->setTarget($target);
  42770. }
  42771. }
  42772. <?php
  42773. namespace Symfony\Component\Finder\Comparator;
  42774. class NumberComparator extends Comparator
  42775. {
  42776. public function __construct($test)
  42777. {
  42778. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  42779. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  42780. }
  42781. $target = $matches[2];
  42782. if (!is_numeric($target)) {
  42783. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  42784. }
  42785. if (isset($matches[3])) {
  42786. switch (strtolower($matches[3])) {
  42787. case 'k':
  42788. $target *= 1000;
  42789. break;
  42790. case 'ki':
  42791. $target *= 1024;
  42792. break;
  42793. case 'm':
  42794. $target *= 1000000;
  42795. break;
  42796. case 'mi':
  42797. $target *= 1024 * 1024;
  42798. break;
  42799. case 'g':
  42800. $target *= 1000000000;
  42801. break;
  42802. case 'gi':
  42803. $target *= 1024 * 1024 * 1024;
  42804. break;
  42805. }
  42806. }
  42807. $this->setTarget($target);
  42808. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  42809. }
  42810. }
  42811. <?php
  42812. namespace Symfony\Component\Finder\Exception;
  42813. class AccessDeniedException extends \UnexpectedValueException
  42814. {
  42815. }
  42816. <?php
  42817. namespace Symfony\Component\Finder\Exception;
  42818. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42819. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42820. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  42821. {
  42822. private $adapter;
  42823. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  42824. {
  42825. $this->adapter = $adapter;
  42826. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  42827. }
  42828. public function getAdapter()
  42829. {
  42830. return $this->adapter;
  42831. }
  42832. }
  42833. <?php
  42834. namespace Symfony\Component\Finder\Exception;
  42835. interface ExceptionInterface
  42836. {
  42837. public function getAdapter();
  42838. }
  42839. <?php
  42840. namespace Symfony\Component\Finder\Exception;
  42841. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42842. class OperationNotPermitedException extends AdapterFailureException
  42843. {
  42844. }
  42845. <?php
  42846. namespace Symfony\Component\Finder\Exception;
  42847. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42848. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42849. use Symfony\Component\Finder\Shell\Command;
  42850. class ShellCommandFailureException extends AdapterFailureException
  42851. {
  42852. private $command;
  42853. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  42854. {
  42855. $this->command = $command;
  42856. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  42857. }
  42858. public function getCommand()
  42859. {
  42860. return $this->command;
  42861. }
  42862. }
  42863. <?php
  42864. namespace Symfony\Component\Finder\Expression;
  42865. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42866. class Expression implements ValueInterface
  42867. {
  42868. const TYPE_REGEX = 1;
  42869. const TYPE_GLOB = 2;
  42870. private $value;
  42871. public static function create($expr)
  42872. {
  42873. return new self($expr);
  42874. }
  42875. public function __construct($expr)
  42876. {
  42877. try {
  42878. $this->value = Regex::create($expr);
  42879. } catch (\InvalidArgumentException $e) {
  42880. $this->value = new Glob($expr);
  42881. }
  42882. }
  42883. public function __toString()
  42884. {
  42885. return $this->render();
  42886. }
  42887. public function render()
  42888. {
  42889. return $this->value->render();
  42890. }
  42891. public function renderPattern()
  42892. {
  42893. return $this->value->renderPattern();
  42894. }
  42895. public function isCaseSensitive()
  42896. {
  42897. return $this->value->isCaseSensitive();
  42898. }
  42899. public function getType()
  42900. {
  42901. return $this->value->getType();
  42902. }
  42903. public function prepend($expr)
  42904. {
  42905. $this->value->prepend($expr);
  42906. return $this;
  42907. }
  42908. public function append($expr)
  42909. {
  42910. $this->value->append($expr);
  42911. return $this;
  42912. }
  42913. public function isRegex()
  42914. {
  42915. return self::TYPE_REGEX === $this->value->getType();
  42916. }
  42917. public function isGlob()
  42918. {
  42919. return self::TYPE_GLOB === $this->value->getType();
  42920. }
  42921. public function getGlob()
  42922. {
  42923. if (self::TYPE_GLOB !== $this->value->getType()) {
  42924. throw new \LogicException('Regex can\'t be transformed to glob.');
  42925. }
  42926. return $this->value;
  42927. }
  42928. public function getRegex()
  42929. {
  42930. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  42931. }
  42932. }
  42933. <?php
  42934. namespace Symfony\Component\Finder\Expression;
  42935. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42936. use Symfony\Component\Finder\Glob as FinderGlob;
  42937. class Glob implements ValueInterface
  42938. {
  42939. private $pattern;
  42940. public function __construct($pattern)
  42941. {
  42942. $this->pattern = $pattern;
  42943. }
  42944. public function render()
  42945. {
  42946. return $this->pattern;
  42947. }
  42948. public function renderPattern()
  42949. {
  42950. return $this->pattern;
  42951. }
  42952. public function getType()
  42953. {
  42954. return Expression::TYPE_GLOB;
  42955. }
  42956. public function isCaseSensitive()
  42957. {
  42958. return true;
  42959. }
  42960. public function prepend($expr)
  42961. {
  42962. $this->pattern = $expr.$this->pattern;
  42963. return $this;
  42964. }
  42965. public function append($expr)
  42966. {
  42967. $this->pattern .= $expr;
  42968. return $this;
  42969. }
  42970. public function isExpandable()
  42971. {
  42972. return false !== strpos($this->pattern, '{')
  42973. && false !== strpos($this->pattern, '}');
  42974. }
  42975. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  42976. {
  42977. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  42978. return new Regex($regex);
  42979. }
  42980. }
  42981. <?php
  42982. namespace Symfony\Component\Finder\Expression;
  42983. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42984. class Regex implements ValueInterface
  42985. {
  42986. const START_FLAG = '^';
  42987. const END_FLAG = '$';
  42988. const BOUNDARY = '~';
  42989. const JOKER = '.*';
  42990. const ESCAPING = '\\';
  42991. private $pattern;
  42992. private $options;
  42993. private $startFlag;
  42994. private $endFlag;
  42995. private $startJoker;
  42996. private $endJoker;
  42997. public static function create($expr)
  42998. {
  42999. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  43000. $start = substr($m[1], 0, 1);
  43001. $end = substr($m[1], -1);
  43002. if (
  43003. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  43004. || ('{' === $start && '}' === $end)
  43005. || ('(' === $start && ')' === $end)
  43006. ) {
  43007. return new self(substr($m[1], 1, -1), $m[2], $end);
  43008. }
  43009. }
  43010. throw new \InvalidArgumentException('Given expression is not a regex.');
  43011. }
  43012. public function __construct($pattern, $options = '', $delimiter = null)
  43013. {
  43014. if (null !== $delimiter) {
  43015. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  43016. }
  43017. $this->parsePattern($pattern);
  43018. $this->options = $options;
  43019. }
  43020. public function __toString()
  43021. {
  43022. return $this->render();
  43023. }
  43024. public function render()
  43025. {
  43026. return self::BOUNDARY
  43027. .$this->renderPattern()
  43028. .self::BOUNDARY
  43029. .$this->options;
  43030. }
  43031. public function renderPattern()
  43032. {
  43033. return ($this->startFlag ? self::START_FLAG : '')
  43034. .($this->startJoker ? self::JOKER : '')
  43035. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  43036. .($this->endJoker ? self::JOKER : '')
  43037. .($this->endFlag ? self::END_FLAG : '');
  43038. }
  43039. public function isCaseSensitive()
  43040. {
  43041. return !$this->hasOption('i');
  43042. }
  43043. public function getType()
  43044. {
  43045. return Expression::TYPE_REGEX;
  43046. }
  43047. public function prepend($expr)
  43048. {
  43049. $this->pattern = $expr.$this->pattern;
  43050. return $this;
  43051. }
  43052. public function append($expr)
  43053. {
  43054. $this->pattern .= $expr;
  43055. return $this;
  43056. }
  43057. public function hasOption($option)
  43058. {
  43059. return false !== strpos($this->options, $option);
  43060. }
  43061. public function addOption($option)
  43062. {
  43063. if (!$this->hasOption($option)) {
  43064. $this->options .= $option;
  43065. }
  43066. return $this;
  43067. }
  43068. public function removeOption($option)
  43069. {
  43070. $this->options = str_replace($option, '', $this->options);
  43071. return $this;
  43072. }
  43073. public function setStartFlag($startFlag)
  43074. {
  43075. $this->startFlag = $startFlag;
  43076. return $this;
  43077. }
  43078. public function hasStartFlag()
  43079. {
  43080. return $this->startFlag;
  43081. }
  43082. public function setEndFlag($endFlag)
  43083. {
  43084. $this->endFlag = (bool) $endFlag;
  43085. return $this;
  43086. }
  43087. public function hasEndFlag()
  43088. {
  43089. return $this->endFlag;
  43090. }
  43091. public function setStartJoker($startJoker)
  43092. {
  43093. $this->startJoker = $startJoker;
  43094. return $this;
  43095. }
  43096. public function hasStartJoker()
  43097. {
  43098. return $this->startJoker;
  43099. }
  43100. public function setEndJoker($endJoker)
  43101. {
  43102. $this->endJoker = (bool) $endJoker;
  43103. return $this;
  43104. }
  43105. public function hasEndJoker()
  43106. {
  43107. return $this->endJoker;
  43108. }
  43109. public function replaceJokers($replacement)
  43110. {
  43111. $replace = function ($subject) use ($replacement) {
  43112. $subject = $subject[0];
  43113. $replace = 0 === substr_count($subject, '\\') % 2;
  43114. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  43115. };
  43116. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  43117. return $this;
  43118. }
  43119. private function parsePattern($pattern)
  43120. {
  43121. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  43122. $pattern = substr($pattern, 1);
  43123. }
  43124. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  43125. $pattern = substr($pattern, 2);
  43126. }
  43127. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  43128. $pattern = substr($pattern, 0, -1);
  43129. }
  43130. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  43131. $pattern = substr($pattern, 0, -2);
  43132. }
  43133. $this->pattern = $pattern;
  43134. }
  43135. }
  43136. <?php
  43137. namespace Symfony\Component\Finder\Expression;
  43138. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43139. interface ValueInterface
  43140. {
  43141. public function render();
  43142. public function renderPattern();
  43143. public function isCaseSensitive();
  43144. public function getType();
  43145. public function prepend($expr);
  43146. public function append($expr);
  43147. }
  43148. <?php
  43149. namespace Symfony\Component\Finder;
  43150. use Symfony\Component\Finder\Adapter\AdapterInterface;
  43151. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  43152. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  43153. use Symfony\Component\Finder\Adapter\PhpAdapter;
  43154. use Symfony\Component\Finder\Comparator\DateComparator;
  43155. use Symfony\Component\Finder\Comparator\NumberComparator;
  43156. use Symfony\Component\Finder\Exception\ExceptionInterface;
  43157. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  43158. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  43159. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  43160. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  43161. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  43162. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  43163. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  43164. use Symfony\Component\Finder\Iterator\SortableIterator;
  43165. class Finder implements \IteratorAggregate, \Countable
  43166. {
  43167. const IGNORE_VCS_FILES = 1;
  43168. const IGNORE_DOT_FILES = 2;
  43169. private $mode = 0;
  43170. private $names = array();
  43171. private $notNames = array();
  43172. private $exclude = array();
  43173. private $filters = array();
  43174. private $depths = array();
  43175. private $sizes = array();
  43176. private $followLinks = false;
  43177. private $sort = false;
  43178. private $ignore = 0;
  43179. private $dirs = array();
  43180. private $dates = array();
  43181. private $iterators = array();
  43182. private $contains = array();
  43183. private $notContains = array();
  43184. private $adapters = null;
  43185. private $paths = array();
  43186. private $notPaths = array();
  43187. private $ignoreUnreadableDirs = false;
  43188. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  43189. public function __construct()
  43190. {
  43191. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  43192. }
  43193. public static function create()
  43194. {
  43195. return new static();
  43196. }
  43197. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  43198. {
  43199. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43200. $this->initDefaultAdapters();
  43201. $this->adapters[$adapter->getName()] = array(
  43202. 'adapter' => $adapter,
  43203. 'priority' => $priority,
  43204. 'selected' => false,
  43205. );
  43206. return $this->sortAdapters();
  43207. }
  43208. public function useBestAdapter()
  43209. {
  43210. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43211. $this->initDefaultAdapters();
  43212. $this->resetAdapterSelection();
  43213. return $this->sortAdapters();
  43214. }
  43215. public function setAdapter($name)
  43216. {
  43217. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43218. $this->initDefaultAdapters();
  43219. if (!isset($this->adapters[$name])) {
  43220. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  43221. }
  43222. $this->resetAdapterSelection();
  43223. $this->adapters[$name]['selected'] = true;
  43224. return $this->sortAdapters();
  43225. }
  43226. public function removeAdapters()
  43227. {
  43228. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43229. $this->adapters = array();
  43230. return $this;
  43231. }
  43232. public function getAdapters()
  43233. {
  43234. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43235. $this->initDefaultAdapters();
  43236. return array_values(array_map(function (array $adapter) {
  43237. return $adapter['adapter'];
  43238. }, $this->adapters));
  43239. }
  43240. public function directories()
  43241. {
  43242. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  43243. return $this;
  43244. }
  43245. public function files()
  43246. {
  43247. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  43248. return $this;
  43249. }
  43250. public function depth($level)
  43251. {
  43252. $this->depths[] = new Comparator\NumberComparator($level);
  43253. return $this;
  43254. }
  43255. public function date($date)
  43256. {
  43257. $this->dates[] = new Comparator\DateComparator($date);
  43258. return $this;
  43259. }
  43260. public function name($pattern)
  43261. {
  43262. $this->names[] = $pattern;
  43263. return $this;
  43264. }
  43265. public function notName($pattern)
  43266. {
  43267. $this->notNames[] = $pattern;
  43268. return $this;
  43269. }
  43270. public function contains($pattern)
  43271. {
  43272. $this->contains[] = $pattern;
  43273. return $this;
  43274. }
  43275. public function notContains($pattern)
  43276. {
  43277. $this->notContains[] = $pattern;
  43278. return $this;
  43279. }
  43280. public function path($pattern)
  43281. {
  43282. $this->paths[] = $pattern;
  43283. return $this;
  43284. }
  43285. public function notPath($pattern)
  43286. {
  43287. $this->notPaths[] = $pattern;
  43288. return $this;
  43289. }
  43290. public function size($size)
  43291. {
  43292. $this->sizes[] = new Comparator\NumberComparator($size);
  43293. return $this;
  43294. }
  43295. public function exclude($dirs)
  43296. {
  43297. $this->exclude = array_merge($this->exclude, (array) $dirs);
  43298. return $this;
  43299. }
  43300. public function ignoreDotFiles($ignoreDotFiles)
  43301. {
  43302. if ($ignoreDotFiles) {
  43303. $this->ignore |= static::IGNORE_DOT_FILES;
  43304. } else {
  43305. $this->ignore &= ~static::IGNORE_DOT_FILES;
  43306. }
  43307. return $this;
  43308. }
  43309. public function ignoreVCS($ignoreVCS)
  43310. {
  43311. if ($ignoreVCS) {
  43312. $this->ignore |= static::IGNORE_VCS_FILES;
  43313. } else {
  43314. $this->ignore &= ~static::IGNORE_VCS_FILES;
  43315. }
  43316. return $this;
  43317. }
  43318. public static function addVCSPattern($pattern)
  43319. {
  43320. foreach ((array) $pattern as $p) {
  43321. self::$vcsPatterns[] = $p;
  43322. }
  43323. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  43324. }
  43325. public function sort(\Closure $closure)
  43326. {
  43327. $this->sort = $closure;
  43328. return $this;
  43329. }
  43330. public function sortByName()
  43331. {
  43332. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  43333. return $this;
  43334. }
  43335. public function sortByType()
  43336. {
  43337. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  43338. return $this;
  43339. }
  43340. public function sortByAccessedTime()
  43341. {
  43342. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  43343. return $this;
  43344. }
  43345. public function sortByChangedTime()
  43346. {
  43347. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  43348. return $this;
  43349. }
  43350. public function sortByModifiedTime()
  43351. {
  43352. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  43353. return $this;
  43354. }
  43355. public function filter(\Closure $closure)
  43356. {
  43357. $this->filters[] = $closure;
  43358. return $this;
  43359. }
  43360. public function followLinks()
  43361. {
  43362. $this->followLinks = true;
  43363. return $this;
  43364. }
  43365. public function ignoreUnreadableDirs($ignore = true)
  43366. {
  43367. $this->ignoreUnreadableDirs = (bool) $ignore;
  43368. return $this;
  43369. }
  43370. public function in($dirs)
  43371. {
  43372. $resolvedDirs = array();
  43373. foreach ((array) $dirs as $dir) {
  43374. if (is_dir($dir)) {
  43375. $resolvedDirs[] = $this->normalizeDir($dir);
  43376. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  43377. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  43378. } else {
  43379. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  43380. }
  43381. }
  43382. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  43383. return $this;
  43384. }
  43385. public function getIterator()
  43386. {
  43387. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43388. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  43389. }
  43390. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43391. return $this->searchInDirectory($this->dirs[0]);
  43392. }
  43393. $iterator = new \AppendIterator();
  43394. foreach ($this->dirs as $dir) {
  43395. $iterator->append($this->searchInDirectory($dir));
  43396. }
  43397. foreach ($this->iterators as $it) {
  43398. $iterator->append($it);
  43399. }
  43400. return $iterator;
  43401. }
  43402. public function append($iterator)
  43403. {
  43404. if ($iterator instanceof \IteratorAggregate) {
  43405. $this->iterators[] = $iterator->getIterator();
  43406. } elseif ($iterator instanceof \Iterator) {
  43407. $this->iterators[] = $iterator;
  43408. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  43409. $it = new \ArrayIterator();
  43410. foreach ($iterator as $file) {
  43411. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  43412. }
  43413. $this->iterators[] = $it;
  43414. } else {
  43415. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  43416. }
  43417. return $this;
  43418. }
  43419. public function count()
  43420. {
  43421. return iterator_count($this->getIterator());
  43422. }
  43423. private function sortAdapters()
  43424. {
  43425. uasort($this->adapters, function (array $a, array $b) {
  43426. if ($a['selected'] || $b['selected']) {
  43427. return $a['selected'] ? -1 : 1;
  43428. }
  43429. return $a['priority'] > $b['priority'] ? -1 : 1;
  43430. });
  43431. return $this;
  43432. }
  43433. private function searchInDirectory($dir)
  43434. {
  43435. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  43436. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  43437. }
  43438. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  43439. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  43440. }
  43441. if ($this->adapters) {
  43442. foreach ($this->adapters as $adapter) {
  43443. if ($adapter['adapter']->isSupported()) {
  43444. try {
  43445. return $this
  43446. ->buildAdapter($adapter['adapter'])
  43447. ->searchInDirectory($dir);
  43448. } catch (ExceptionInterface $e) {
  43449. }
  43450. }
  43451. }
  43452. }
  43453. $minDepth = 0;
  43454. $maxDepth = PHP_INT_MAX;
  43455. foreach ($this->depths as $comparator) {
  43456. switch ($comparator->getOperator()) {
  43457. case '>':
  43458. $minDepth = $comparator->getTarget() + 1;
  43459. break;
  43460. case '>=':
  43461. $minDepth = $comparator->getTarget();
  43462. break;
  43463. case '<':
  43464. $maxDepth = $comparator->getTarget() - 1;
  43465. break;
  43466. case '<=':
  43467. $maxDepth = $comparator->getTarget();
  43468. break;
  43469. default:
  43470. $minDepth = $maxDepth = $comparator->getTarget();
  43471. }
  43472. }
  43473. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  43474. if ($this->followLinks) {
  43475. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  43476. }
  43477. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  43478. if ($this->exclude) {
  43479. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  43480. }
  43481. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  43482. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  43483. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  43484. }
  43485. if ($this->mode) {
  43486. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  43487. }
  43488. if ($this->names || $this->notNames) {
  43489. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  43490. }
  43491. if ($this->contains || $this->notContains) {
  43492. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  43493. }
  43494. if ($this->sizes) {
  43495. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  43496. }
  43497. if ($this->dates) {
  43498. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  43499. }
  43500. if ($this->filters) {
  43501. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  43502. }
  43503. if ($this->paths || $this->notPaths) {
  43504. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  43505. }
  43506. if ($this->sort) {
  43507. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  43508. $iterator = $iteratorAggregate->getIterator();
  43509. }
  43510. return $iterator;
  43511. }
  43512. private function buildAdapter(AdapterInterface $adapter)
  43513. {
  43514. return $adapter
  43515. ->setFollowLinks($this->followLinks)
  43516. ->setDepths($this->depths)
  43517. ->setMode($this->mode)
  43518. ->setExclude($this->exclude)
  43519. ->setNames($this->names)
  43520. ->setNotNames($this->notNames)
  43521. ->setContains($this->contains)
  43522. ->setNotContains($this->notContains)
  43523. ->setSizes($this->sizes)
  43524. ->setDates($this->dates)
  43525. ->setFilters($this->filters)
  43526. ->setSort($this->sort)
  43527. ->setPath($this->paths)
  43528. ->setNotPath($this->notPaths)
  43529. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  43530. }
  43531. private function resetAdapterSelection()
  43532. {
  43533. $this->adapters = array_map(function (array $properties) {
  43534. $properties['selected'] = false;
  43535. return $properties;
  43536. }, $this->adapters);
  43537. }
  43538. private function initDefaultAdapters()
  43539. {
  43540. if (null === $this->adapters) {
  43541. $this->adapters = array();
  43542. $this
  43543. ->addAdapter(new GnuFindAdapter())
  43544. ->addAdapter(new BsdFindAdapter())
  43545. ->addAdapter(new PhpAdapter(), -50)
  43546. ->setAdapter('php')
  43547. ;
  43548. }
  43549. }
  43550. private function normalizeDir($dir)
  43551. {
  43552. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  43553. }
  43554. }
  43555. <?php
  43556. namespace Symfony\Component\Finder;
  43557. class Glob
  43558. {
  43559. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  43560. {
  43561. $firstByte = true;
  43562. $escaping = false;
  43563. $inCurlies = 0;
  43564. $regex = '';
  43565. $sizeGlob = \strlen($glob);
  43566. for ($i = 0; $i < $sizeGlob; ++$i) {
  43567. $car = $glob[$i];
  43568. if ($firstByte) {
  43569. if ($strictLeadingDot && '.' !== $car) {
  43570. $regex .= '(?=[^\.])';
  43571. }
  43572. $firstByte = false;
  43573. }
  43574. if ('/' === $car) {
  43575. $firstByte = true;
  43576. }
  43577. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  43578. $regex .= "\\$car";
  43579. } elseif ('*' === $car) {
  43580. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  43581. } elseif ('?' === $car) {
  43582. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  43583. } elseif ('{' === $car) {
  43584. $regex .= $escaping ? '\\{' : '(';
  43585. if (!$escaping) {
  43586. ++$inCurlies;
  43587. }
  43588. } elseif ('}' === $car && $inCurlies) {
  43589. $regex .= $escaping ? '}' : ')';
  43590. if (!$escaping) {
  43591. --$inCurlies;
  43592. }
  43593. } elseif (',' === $car && $inCurlies) {
  43594. $regex .= $escaping ? ',' : '|';
  43595. } elseif ('\\' === $car) {
  43596. if ($escaping) {
  43597. $regex .= '\\\\';
  43598. $escaping = false;
  43599. } else {
  43600. $escaping = true;
  43601. }
  43602. continue;
  43603. } else {
  43604. $regex .= $car;
  43605. }
  43606. $escaping = false;
  43607. }
  43608. return $delimiter.'^'.$regex.'$'.$delimiter;
  43609. }
  43610. }
  43611. <?php
  43612. namespace Symfony\Component\Finder\Iterator;
  43613. class CustomFilterIterator extends FilterIterator
  43614. {
  43615. private $filters = array();
  43616. public function __construct(\Iterator $iterator, array $filters)
  43617. {
  43618. foreach ($filters as $filter) {
  43619. if (!\is_callable($filter)) {
  43620. throw new \InvalidArgumentException('Invalid PHP callback.');
  43621. }
  43622. }
  43623. $this->filters = $filters;
  43624. parent::__construct($iterator);
  43625. }
  43626. public function accept()
  43627. {
  43628. $fileinfo = $this->current();
  43629. foreach ($this->filters as $filter) {
  43630. if (false === \call_user_func($filter, $fileinfo)) {
  43631. return false;
  43632. }
  43633. }
  43634. return true;
  43635. }
  43636. }
  43637. <?php
  43638. namespace Symfony\Component\Finder\Iterator;
  43639. use Symfony\Component\Finder\Comparator\DateComparator;
  43640. class DateRangeFilterIterator extends FilterIterator
  43641. {
  43642. private $comparators = array();
  43643. public function __construct(\Iterator $iterator, array $comparators)
  43644. {
  43645. $this->comparators = $comparators;
  43646. parent::__construct($iterator);
  43647. }
  43648. public function accept()
  43649. {
  43650. $fileinfo = $this->current();
  43651. if (!file_exists($fileinfo->getPathname())) {
  43652. return false;
  43653. }
  43654. $filedate = $fileinfo->getMTime();
  43655. foreach ($this->comparators as $compare) {
  43656. if (!$compare->test($filedate)) {
  43657. return false;
  43658. }
  43659. }
  43660. return true;
  43661. }
  43662. }
  43663. <?php
  43664. namespace Symfony\Component\Finder\Iterator;
  43665. class DepthRangeFilterIterator extends FilterIterator
  43666. {
  43667. private $minDepth = 0;
  43668. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  43669. {
  43670. $this->minDepth = $minDepth;
  43671. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  43672. parent::__construct($iterator);
  43673. }
  43674. public function accept()
  43675. {
  43676. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  43677. }
  43678. }
  43679. <?php
  43680. namespace Symfony\Component\Finder\Iterator;
  43681. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  43682. {
  43683. private $iterator;
  43684. private $isRecursive;
  43685. private $excludedDirs = array();
  43686. private $excludedPattern;
  43687. public function __construct(\Iterator $iterator, array $directories)
  43688. {
  43689. $this->iterator = $iterator;
  43690. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  43691. $patterns = array();
  43692. foreach ($directories as $directory) {
  43693. $directory = rtrim($directory, '/');
  43694. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  43695. $patterns[] = preg_quote($directory, '#');
  43696. } else {
  43697. $this->excludedDirs[$directory] = true;
  43698. }
  43699. }
  43700. if ($patterns) {
  43701. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  43702. }
  43703. parent::__construct($iterator);
  43704. }
  43705. public function accept()
  43706. {
  43707. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  43708. return false;
  43709. }
  43710. if ($this->excludedPattern) {
  43711. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  43712. $path = str_replace('\\', '/', $path);
  43713. return !preg_match($this->excludedPattern, $path);
  43714. }
  43715. return true;
  43716. }
  43717. public function hasChildren()
  43718. {
  43719. return $this->isRecursive && $this->iterator->hasChildren();
  43720. }
  43721. public function getChildren()
  43722. {
  43723. $children = new self($this->iterator->getChildren(), array());
  43724. $children->excludedDirs = $this->excludedDirs;
  43725. $children->excludedPattern = $this->excludedPattern;
  43726. return $children;
  43727. }
  43728. }
  43729. <?php
  43730. namespace Symfony\Component\Finder\Iterator;
  43731. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43732. use Symfony\Component\Finder\SplFileInfo;
  43733. class FilePathsIterator extends \ArrayIterator
  43734. {
  43735. private $baseDir;
  43736. private $baseDirLength;
  43737. private $subPath;
  43738. private $subPathname;
  43739. private $current;
  43740. public function __construct(array $paths, $baseDir)
  43741. {
  43742. $this->baseDir = $baseDir;
  43743. $this->baseDirLength = \strlen($baseDir);
  43744. parent::__construct($paths);
  43745. }
  43746. public function __call($name, array $arguments)
  43747. {
  43748. return \call_user_func_array(array($this->current(), $name), $arguments);
  43749. }
  43750. public function current()
  43751. {
  43752. return $this->current;
  43753. }
  43754. public function key()
  43755. {
  43756. return $this->current->getPathname();
  43757. }
  43758. public function next()
  43759. {
  43760. parent::next();
  43761. $this->buildProperties();
  43762. }
  43763. public function rewind()
  43764. {
  43765. parent::rewind();
  43766. $this->buildProperties();
  43767. }
  43768. public function getSubPath()
  43769. {
  43770. return $this->subPath;
  43771. }
  43772. public function getSubPathname()
  43773. {
  43774. return $this->subPathname;
  43775. }
  43776. private function buildProperties()
  43777. {
  43778. $absolutePath = parent::current();
  43779. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  43780. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  43781. $dir = \dirname($this->subPathname);
  43782. $this->subPath = '.' === $dir ? '' : $dir;
  43783. } else {
  43784. $this->subPath = $this->subPathname = '';
  43785. }
  43786. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  43787. }
  43788. }
  43789. <?php
  43790. namespace Symfony\Component\Finder\Iterator;
  43791. class FileTypeFilterIterator extends FilterIterator
  43792. {
  43793. const ONLY_FILES = 1;
  43794. const ONLY_DIRECTORIES = 2;
  43795. private $mode;
  43796. public function __construct(\Iterator $iterator, $mode)
  43797. {
  43798. $this->mode = $mode;
  43799. parent::__construct($iterator);
  43800. }
  43801. public function accept()
  43802. {
  43803. $fileinfo = $this->current();
  43804. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  43805. return false;
  43806. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  43807. return false;
  43808. }
  43809. return true;
  43810. }
  43811. }
  43812. <?php
  43813. namespace Symfony\Component\Finder\Iterator;
  43814. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  43815. {
  43816. public function accept()
  43817. {
  43818. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  43819. return true;
  43820. }
  43821. $fileinfo = $this->current();
  43822. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  43823. return false;
  43824. }
  43825. $content = $fileinfo->getContents();
  43826. if (!$content) {
  43827. return false;
  43828. }
  43829. return $this->isAccepted($content);
  43830. }
  43831. protected function toRegex($str)
  43832. {
  43833. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43834. }
  43835. }
  43836. <?php
  43837. namespace Symfony\Component\Finder\Iterator;
  43838. use Symfony\Component\Finder\Glob;
  43839. class FilenameFilterIterator extends MultiplePcreFilterIterator
  43840. {
  43841. public function accept()
  43842. {
  43843. return $this->isAccepted($this->current()->getFilename());
  43844. }
  43845. protected function toRegex($str)
  43846. {
  43847. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  43848. }
  43849. }
  43850. <?php
  43851. namespace Symfony\Component\Finder\Iterator;
  43852. abstract class FilterIterator extends \FilterIterator
  43853. {
  43854. public function rewind()
  43855. {
  43856. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  43857. parent::rewind();
  43858. return;
  43859. }
  43860. $iterator = $this;
  43861. while ($iterator instanceof \OuterIterator) {
  43862. $innerIterator = $iterator->getInnerIterator();
  43863. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  43864. if ($innerIterator->isRewindable()) {
  43865. $innerIterator->next();
  43866. $innerIterator->rewind();
  43867. }
  43868. } elseif ($innerIterator instanceof \FilesystemIterator) {
  43869. $innerIterator->next();
  43870. $innerIterator->rewind();
  43871. }
  43872. $iterator = $innerIterator;
  43873. }
  43874. parent::rewind();
  43875. }
  43876. }
  43877. <?php
  43878. namespace Symfony\Component\Finder\Iterator;
  43879. abstract class MultiplePcreFilterIterator extends FilterIterator
  43880. {
  43881. protected $matchRegexps = array();
  43882. protected $noMatchRegexps = array();
  43883. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  43884. {
  43885. foreach ($matchPatterns as $pattern) {
  43886. $this->matchRegexps[] = $this->toRegex($pattern);
  43887. }
  43888. foreach ($noMatchPatterns as $pattern) {
  43889. $this->noMatchRegexps[] = $this->toRegex($pattern);
  43890. }
  43891. parent::__construct($iterator);
  43892. }
  43893. protected function isAccepted($string)
  43894. {
  43895. foreach ($this->noMatchRegexps as $regex) {
  43896. if (preg_match($regex, $string)) {
  43897. return false;
  43898. }
  43899. }
  43900. if ($this->matchRegexps) {
  43901. foreach ($this->matchRegexps as $regex) {
  43902. if (preg_match($regex, $string)) {
  43903. return true;
  43904. }
  43905. }
  43906. return false;
  43907. }
  43908. return true;
  43909. }
  43910. protected function isRegex($str)
  43911. {
  43912. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  43913. $start = substr($m[1], 0, 1);
  43914. $end = substr($m[1], -1);
  43915. if ($start === $end) {
  43916. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  43917. }
  43918. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  43919. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  43920. return true;
  43921. }
  43922. }
  43923. }
  43924. return false;
  43925. }
  43926. abstract protected function toRegex($str);
  43927. }
  43928. <?php
  43929. namespace Symfony\Component\Finder\Iterator;
  43930. class PathFilterIterator extends MultiplePcreFilterIterator
  43931. {
  43932. public function accept()
  43933. {
  43934. $filename = $this->current()->getRelativePathname();
  43935. if ('\\' === \DIRECTORY_SEPARATOR) {
  43936. $filename = str_replace('\\', '/', $filename);
  43937. }
  43938. return $this->isAccepted($filename);
  43939. }
  43940. protected function toRegex($str)
  43941. {
  43942. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43943. }
  43944. }
  43945. <?php
  43946. namespace Symfony\Component\Finder\Iterator;
  43947. use Symfony\Component\Finder\Exception\AccessDeniedException;
  43948. use Symfony\Component\Finder\SplFileInfo;
  43949. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  43950. {
  43951. private $ignoreUnreadableDirs;
  43952. private $rewindable;
  43953. private $rootPath;
  43954. private $subPath;
  43955. private $directorySeparator = '/';
  43956. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  43957. {
  43958. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  43959. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  43960. }
  43961. parent::__construct($path, $flags);
  43962. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  43963. $this->rootPath = (string) $path;
  43964. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  43965. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  43966. }
  43967. }
  43968. public function current()
  43969. {
  43970. if (null === $subPathname = $this->subPath) {
  43971. $subPathname = $this->subPath = (string) $this->getSubPath();
  43972. }
  43973. if ('' !== $subPathname) {
  43974. $subPathname .= $this->directorySeparator;
  43975. }
  43976. $subPathname .= $this->getFilename();
  43977. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  43978. }
  43979. public function getChildren()
  43980. {
  43981. try {
  43982. $children = parent::getChildren();
  43983. if ($children instanceof self) {
  43984. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  43985. $children->rewindable = &$this->rewindable;
  43986. $children->rootPath = $this->rootPath;
  43987. }
  43988. return $children;
  43989. } catch (\UnexpectedValueException $e) {
  43990. if ($this->ignoreUnreadableDirs) {
  43991. return new \RecursiveArrayIterator(array());
  43992. } else {
  43993. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  43994. }
  43995. }
  43996. }
  43997. public function rewind()
  43998. {
  43999. if (false === $this->isRewindable()) {
  44000. return;
  44001. }
  44002. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  44003. parent::next();
  44004. }
  44005. parent::rewind();
  44006. }
  44007. public function isRewindable()
  44008. {
  44009. if (null !== $this->rewindable) {
  44010. return $this->rewindable;
  44011. }
  44012. if ('' === $this->getPath()) {
  44013. return $this->rewindable = false;
  44014. }
  44015. if (false !== $stream = @opendir($this->getPath())) {
  44016. $infos = stream_get_meta_data($stream);
  44017. closedir($stream);
  44018. if ($infos['seekable']) {
  44019. return $this->rewindable = true;
  44020. }
  44021. }
  44022. return $this->rewindable = false;
  44023. }
  44024. }
  44025. <?php
  44026. namespace Symfony\Component\Finder\Iterator;
  44027. use Symfony\Component\Finder\Comparator\NumberComparator;
  44028. class SizeRangeFilterIterator extends FilterIterator
  44029. {
  44030. private $comparators = array();
  44031. public function __construct(\Iterator $iterator, array $comparators)
  44032. {
  44033. $this->comparators = $comparators;
  44034. parent::__construct($iterator);
  44035. }
  44036. public function accept()
  44037. {
  44038. $fileinfo = $this->current();
  44039. if (!$fileinfo->isFile()) {
  44040. return true;
  44041. }
  44042. $filesize = $fileinfo->getSize();
  44043. foreach ($this->comparators as $compare) {
  44044. if (!$compare->test($filesize)) {
  44045. return false;
  44046. }
  44047. }
  44048. return true;
  44049. }
  44050. }
  44051. <?php
  44052. namespace Symfony\Component\Finder\Iterator;
  44053. class SortableIterator implements \IteratorAggregate
  44054. {
  44055. const SORT_BY_NAME = 1;
  44056. const SORT_BY_TYPE = 2;
  44057. const SORT_BY_ACCESSED_TIME = 3;
  44058. const SORT_BY_CHANGED_TIME = 4;
  44059. const SORT_BY_MODIFIED_TIME = 5;
  44060. private $iterator;
  44061. private $sort;
  44062. public function __construct(\Traversable $iterator, $sort)
  44063. {
  44064. $this->iterator = $iterator;
  44065. if (self::SORT_BY_NAME === $sort) {
  44066. $this->sort = function ($a, $b) {
  44067. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44068. };
  44069. } elseif (self::SORT_BY_TYPE === $sort) {
  44070. $this->sort = function ($a, $b) {
  44071. if ($a->isDir() && $b->isFile()) {
  44072. return -1;
  44073. } elseif ($a->isFile() && $b->isDir()) {
  44074. return 1;
  44075. }
  44076. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44077. };
  44078. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  44079. $this->sort = function ($a, $b) {
  44080. return $a->getATime() - $b->getATime();
  44081. };
  44082. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  44083. $this->sort = function ($a, $b) {
  44084. return $a->getCTime() - $b->getCTime();
  44085. };
  44086. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  44087. $this->sort = function ($a, $b) {
  44088. return $a->getMTime() - $b->getMTime();
  44089. };
  44090. } elseif (\is_callable($sort)) {
  44091. $this->sort = $sort;
  44092. } else {
  44093. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  44094. }
  44095. }
  44096. public function getIterator()
  44097. {
  44098. $array = iterator_to_array($this->iterator, true);
  44099. uasort($array, $this->sort);
  44100. return new \ArrayIterator($array);
  44101. }
  44102. }
  44103. Copyright (c) 2004-2018 Fabien Potencier
  44104. Permission is hereby granted, free of charge, to any person obtaining a copy
  44105. of this software and associated documentation files (the "Software"), to deal
  44106. in the Software without restriction, including without limitation the rights
  44107. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44108. copies of the Software, and to permit persons to whom the Software is furnished
  44109. to do so, subject to the following conditions:
  44110. The above copyright notice and this permission notice shall be included in all
  44111. copies or substantial portions of the Software.
  44112. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44113. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44114. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44115. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44116. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44117. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44118. THE SOFTWARE.
  44119. <?php
  44120. namespace Symfony\Component\Finder\Shell;
  44121. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44122. class Command
  44123. {
  44124. private $parent;
  44125. private $bits = array();
  44126. private $labels = array();
  44127. private $errorHandler;
  44128. public function __construct(Command $parent = null)
  44129. {
  44130. $this->parent = $parent;
  44131. }
  44132. public function __toString()
  44133. {
  44134. return $this->join();
  44135. }
  44136. public static function create(Command $parent = null)
  44137. {
  44138. return new self($parent);
  44139. }
  44140. public static function escape($input)
  44141. {
  44142. return escapeshellcmd($input);
  44143. }
  44144. public static function quote($input)
  44145. {
  44146. return escapeshellarg($input);
  44147. }
  44148. public function add($bit)
  44149. {
  44150. $this->bits[] = $bit;
  44151. return $this;
  44152. }
  44153. public function top($bit)
  44154. {
  44155. array_unshift($this->bits, $bit);
  44156. foreach ($this->labels as $label => $index) {
  44157. ++$this->labels[$label];
  44158. }
  44159. return $this;
  44160. }
  44161. public function arg($arg)
  44162. {
  44163. $this->bits[] = self::quote($arg);
  44164. return $this;
  44165. }
  44166. public function cmd($esc)
  44167. {
  44168. $this->bits[] = self::escape($esc);
  44169. return $this;
  44170. }
  44171. public function ins($label)
  44172. {
  44173. if (isset($this->labels[$label])) {
  44174. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  44175. }
  44176. $this->bits[] = self::create($this);
  44177. $this->labels[$label] = \count($this->bits) - 1;
  44178. return $this->bits[$this->labels[$label]];
  44179. }
  44180. public function get($label)
  44181. {
  44182. if (!isset($this->labels[$label])) {
  44183. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  44184. }
  44185. return $this->bits[$this->labels[$label]];
  44186. }
  44187. public function end()
  44188. {
  44189. if (null === $this->parent) {
  44190. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  44191. }
  44192. return $this->parent;
  44193. }
  44194. public function length()
  44195. {
  44196. return \count($this->bits);
  44197. }
  44198. public function setErrorHandler(\Closure $errorHandler)
  44199. {
  44200. $this->errorHandler = $errorHandler;
  44201. return $this;
  44202. }
  44203. public function getErrorHandler()
  44204. {
  44205. return $this->errorHandler;
  44206. }
  44207. public function execute()
  44208. {
  44209. if (null === $errorHandler = $this->errorHandler) {
  44210. exec($this->join(), $output);
  44211. } else {
  44212. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  44213. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  44214. if ($error = stream_get_contents($pipes[2])) {
  44215. $errorHandler($error);
  44216. }
  44217. proc_close($process);
  44218. }
  44219. return $output ?: array();
  44220. }
  44221. public function join()
  44222. {
  44223. return implode(' ', array_filter(
  44224. array_map(function ($bit) {
  44225. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  44226. }, $this->bits),
  44227. function ($bit) { return null !== $bit; }
  44228. ));
  44229. }
  44230. public function addAtIndex($bit, $index)
  44231. {
  44232. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  44233. return $this;
  44234. }
  44235. }
  44236. <?php
  44237. namespace Symfony\Component\Finder\Shell;
  44238. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44239. class Shell
  44240. {
  44241. const TYPE_UNIX = 1;
  44242. const TYPE_DARWIN = 2;
  44243. const TYPE_CYGWIN = 3;
  44244. const TYPE_WINDOWS = 4;
  44245. const TYPE_BSD = 5;
  44246. private $type;
  44247. public function getType()
  44248. {
  44249. if (null === $this->type) {
  44250. $this->type = $this->guessType();
  44251. }
  44252. return $this->type;
  44253. }
  44254. public function testCommand($command)
  44255. {
  44256. if (!\function_exists('exec')) {
  44257. return false;
  44258. }
  44259. $testCommand = 'which ';
  44260. if (self::TYPE_WINDOWS === $this->type) {
  44261. $testCommand = 'where ';
  44262. }
  44263. $command = escapeshellcmd($command);
  44264. exec($testCommand.$command, $output, $code);
  44265. return 0 === $code && \count($output) > 0;
  44266. }
  44267. private function guessType()
  44268. {
  44269. $os = strtolower(PHP_OS);
  44270. if (false !== strpos($os, 'cygwin')) {
  44271. return self::TYPE_CYGWIN;
  44272. }
  44273. if (false !== strpos($os, 'darwin')) {
  44274. return self::TYPE_DARWIN;
  44275. }
  44276. if (false !== strpos($os, 'bsd')) {
  44277. return self::TYPE_BSD;
  44278. }
  44279. if (0 === strpos($os, 'win')) {
  44280. return self::TYPE_WINDOWS;
  44281. }
  44282. return self::TYPE_UNIX;
  44283. }
  44284. }
  44285. <?php
  44286. namespace Symfony\Component\Finder;
  44287. class SplFileInfo extends \SplFileInfo
  44288. {
  44289. private $relativePath;
  44290. private $relativePathname;
  44291. public function __construct($file, $relativePath, $relativePathname)
  44292. {
  44293. parent::__construct($file);
  44294. $this->relativePath = $relativePath;
  44295. $this->relativePathname = $relativePathname;
  44296. }
  44297. public function getRelativePath()
  44298. {
  44299. return $this->relativePath;
  44300. }
  44301. public function getRelativePathname()
  44302. {
  44303. return $this->relativePathname;
  44304. }
  44305. public function getContents()
  44306. {
  44307. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  44308. $content = file_get_contents($this->getPathname());
  44309. restore_error_handler();
  44310. if (false === $content) {
  44311. throw new \RuntimeException($error);
  44312. }
  44313. return $content;
  44314. }
  44315. }
  44316. <?php
  44317. namespace Symfony\Polyfill\Ctype;
  44318. final class Ctype
  44319. {
  44320. public static function ctype_alnum($text)
  44321. {
  44322. $text = self::convert_int_to_char_for_ctype($text);
  44323. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  44324. }
  44325. public static function ctype_alpha($text)
  44326. {
  44327. $text = self::convert_int_to_char_for_ctype($text);
  44328. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  44329. }
  44330. public static function ctype_cntrl($text)
  44331. {
  44332. $text = self::convert_int_to_char_for_ctype($text);
  44333. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  44334. }
  44335. public static function ctype_digit($text)
  44336. {
  44337. $text = self::convert_int_to_char_for_ctype($text);
  44338. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  44339. }
  44340. public static function ctype_graph($text)
  44341. {
  44342. $text = self::convert_int_to_char_for_ctype($text);
  44343. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  44344. }
  44345. public static function ctype_lower($text)
  44346. {
  44347. $text = self::convert_int_to_char_for_ctype($text);
  44348. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  44349. }
  44350. public static function ctype_print($text)
  44351. {
  44352. $text = self::convert_int_to_char_for_ctype($text);
  44353. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  44354. }
  44355. public static function ctype_punct($text)
  44356. {
  44357. $text = self::convert_int_to_char_for_ctype($text);
  44358. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  44359. }
  44360. public static function ctype_space($text)
  44361. {
  44362. $text = self::convert_int_to_char_for_ctype($text);
  44363. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  44364. }
  44365. public static function ctype_upper($text)
  44366. {
  44367. $text = self::convert_int_to_char_for_ctype($text);
  44368. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  44369. }
  44370. public static function ctype_xdigit($text)
  44371. {
  44372. $text = self::convert_int_to_char_for_ctype($text);
  44373. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  44374. }
  44375. private static function convert_int_to_char_for_ctype($int)
  44376. {
  44377. if (!\is_int($int)) {
  44378. return $int;
  44379. }
  44380. if ($int < -128 || $int > 255) {
  44381. return (string) $int;
  44382. }
  44383. if ($int < 0) {
  44384. $int += 256;
  44385. }
  44386. return \chr($int);
  44387. }
  44388. }
  44389. Copyright (c) 2018-2019 Fabien Potencier
  44390. Permission is hereby granted, free of charge, to any person obtaining a copy
  44391. of this software and associated documentation files (the "Software"), to deal
  44392. in the Software without restriction, including without limitation the rights
  44393. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44394. copies of the Software, and to permit persons to whom the Software is furnished
  44395. to do so, subject to the following conditions:
  44396. The above copyright notice and this permission notice shall be included in all
  44397. copies or substantial portions of the Software.
  44398. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44399. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44400. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44401. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44402. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44403. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44404. THE SOFTWARE.
  44405. <?php
  44406. use Symfony\Polyfill\Ctype as p;
  44407. if (!function_exists('ctype_alnum')) {
  44408. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  44409. }
  44410. if (!function_exists('ctype_alpha')) {
  44411. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  44412. }
  44413. if (!function_exists('ctype_cntrl')) {
  44414. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  44415. }
  44416. if (!function_exists('ctype_digit')) {
  44417. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  44418. }
  44419. if (!function_exists('ctype_graph')) {
  44420. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  44421. }
  44422. if (!function_exists('ctype_lower')) {
  44423. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  44424. }
  44425. if (!function_exists('ctype_print')) {
  44426. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  44427. }
  44428. if (!function_exists('ctype_punct')) {
  44429. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  44430. }
  44431. if (!function_exists('ctype_space')) {
  44432. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  44433. }
  44434. if (!function_exists('ctype_upper')) {
  44435. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  44436. }
  44437. if (!function_exists('ctype_xdigit')) {
  44438. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  44439. }
  44440. Copyright (c) 2015-2019 Fabien Potencier
  44441. Permission is hereby granted, free of charge, to any person obtaining a copy
  44442. of this software and associated documentation files (the "Software"), to deal
  44443. in the Software without restriction, including without limitation the rights
  44444. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44445. copies of the Software, and to permit persons to whom the Software is furnished
  44446. to do so, subject to the following conditions:
  44447. The above copyright notice and this permission notice shall be included in all
  44448. copies or substantial portions of the Software.
  44449. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44450. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44451. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44452. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44453. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44454. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44455. THE SOFTWARE.
  44456. <?php
  44457. namespace Symfony\Polyfill\Mbstring;
  44458. final class Mbstring
  44459. {
  44460. const MB_CASE_FOLD = PHP_INT_MAX;
  44461. private static $encodingList = array('ASCII', 'UTF-8');
  44462. private static $language = 'neutral';
  44463. private static $internalEncoding = 'UTF-8';
  44464. private static $caseFold = array(
  44465. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  44466. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  44467. );
  44468. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  44469. {
  44470. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  44471. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  44472. } else {
  44473. $fromEncoding = self::getEncoding($fromEncoding);
  44474. }
  44475. $toEncoding = self::getEncoding($toEncoding);
  44476. if ('BASE64' === $fromEncoding) {
  44477. $s = base64_decode($s);
  44478. $fromEncoding = $toEncoding;
  44479. }
  44480. if ('BASE64' === $toEncoding) {
  44481. return base64_encode($s);
  44482. }
  44483. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  44484. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  44485. $fromEncoding = 'Windows-1252';
  44486. }
  44487. if ('UTF-8' !== $fromEncoding) {
  44488. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  44489. }
  44490. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  44491. }
  44492. if ('HTML-ENTITIES' === $fromEncoding) {
  44493. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  44494. $fromEncoding = 'UTF-8';
  44495. }
  44496. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  44497. }
  44498. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  44499. {
  44500. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  44501. $ok = true;
  44502. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  44503. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  44504. $ok = false;
  44505. }
  44506. });
  44507. return $ok ? $fromEncoding : false;
  44508. }
  44509. public static function mb_decode_mimeheader($s)
  44510. {
  44511. return iconv_mime_decode($s, 2, self::$internalEncoding);
  44512. }
  44513. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  44514. {
  44515. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  44516. }
  44517. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  44518. {
  44519. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44520. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44521. return null;
  44522. }
  44523. if (!\is_array($convmap) || !$convmap) {
  44524. return false;
  44525. }
  44526. if (null !== $encoding && !\is_scalar($encoding)) {
  44527. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44528. return '';
  44529. }
  44530. $s = (string) $s;
  44531. if ('' === $s) {
  44532. return '';
  44533. }
  44534. $encoding = self::getEncoding($encoding);
  44535. if ('UTF-8' === $encoding) {
  44536. $encoding = null;
  44537. if (!preg_match('//u', $s)) {
  44538. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44539. }
  44540. } else {
  44541. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44542. }
  44543. $cnt = floor(\count($convmap) / 4) * 4;
  44544. for ($i = 0; $i < $cnt; $i += 4) {
  44545. $convmap[$i] += $convmap[$i + 2];
  44546. $convmap[$i + 1] += $convmap[$i + 2];
  44547. }
  44548. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  44549. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  44550. for ($i = 0; $i < $cnt; $i += 4) {
  44551. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  44552. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  44553. }
  44554. }
  44555. return $m[0];
  44556. }, $s);
  44557. if (null === $encoding) {
  44558. return $s;
  44559. }
  44560. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44561. }
  44562. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  44563. {
  44564. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44565. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44566. return null;
  44567. }
  44568. if (!\is_array($convmap) || !$convmap) {
  44569. return false;
  44570. }
  44571. if (null !== $encoding && !\is_scalar($encoding)) {
  44572. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44573. return null;
  44574. }
  44575. if (null !== $is_hex && !\is_scalar($is_hex)) {
  44576. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  44577. return null;
  44578. }
  44579. $s = (string) $s;
  44580. if ('' === $s) {
  44581. return '';
  44582. }
  44583. $encoding = self::getEncoding($encoding);
  44584. if ('UTF-8' === $encoding) {
  44585. $encoding = null;
  44586. if (!preg_match('//u', $s)) {
  44587. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44588. }
  44589. } else {
  44590. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44591. }
  44592. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44593. $cnt = floor(\count($convmap) / 4) * 4;
  44594. $i = 0;
  44595. $len = \strlen($s);
  44596. $result = '';
  44597. while ($i < $len) {
  44598. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44599. $uchr = substr($s, $i, $ulen);
  44600. $i += $ulen;
  44601. $c = self::mb_ord($uchr);
  44602. for ($j = 0; $j < $cnt; $j += 4) {
  44603. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  44604. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  44605. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  44606. continue 2;
  44607. }
  44608. }
  44609. $result .= $uchr;
  44610. }
  44611. if (null === $encoding) {
  44612. return $result;
  44613. }
  44614. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  44615. }
  44616. public static function mb_convert_case($s, $mode, $encoding = null)
  44617. {
  44618. $s = (string) $s;
  44619. if ('' === $s) {
  44620. return '';
  44621. }
  44622. $encoding = self::getEncoding($encoding);
  44623. if ('UTF-8' === $encoding) {
  44624. $encoding = null;
  44625. if (!preg_match('//u', $s)) {
  44626. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44627. }
  44628. } else {
  44629. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44630. }
  44631. if (MB_CASE_TITLE == $mode) {
  44632. static $titleRegexp = null;
  44633. if (null === $titleRegexp) {
  44634. $titleRegexp = self::getData('titleCaseRegexp');
  44635. }
  44636. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  44637. } else {
  44638. if (MB_CASE_UPPER == $mode) {
  44639. static $upper = null;
  44640. if (null === $upper) {
  44641. $upper = self::getData('upperCase');
  44642. }
  44643. $map = $upper;
  44644. } else {
  44645. if (self::MB_CASE_FOLD === $mode) {
  44646. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  44647. }
  44648. static $lower = null;
  44649. if (null === $lower) {
  44650. $lower = self::getData('lowerCase');
  44651. }
  44652. $map = $lower;
  44653. }
  44654. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44655. $i = 0;
  44656. $len = \strlen($s);
  44657. while ($i < $len) {
  44658. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44659. $uchr = substr($s, $i, $ulen);
  44660. $i += $ulen;
  44661. if (isset($map[$uchr])) {
  44662. $uchr = $map[$uchr];
  44663. $nlen = \strlen($uchr);
  44664. if ($nlen == $ulen) {
  44665. $nlen = $i;
  44666. do {
  44667. $s[--$nlen] = $uchr[--$ulen];
  44668. } while ($ulen);
  44669. } else {
  44670. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  44671. $len += $nlen - $ulen;
  44672. $i += $nlen - $ulen;
  44673. }
  44674. }
  44675. }
  44676. }
  44677. if (null === $encoding) {
  44678. return $s;
  44679. }
  44680. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44681. }
  44682. public static function mb_internal_encoding($encoding = null)
  44683. {
  44684. if (null === $encoding) {
  44685. return self::$internalEncoding;
  44686. }
  44687. $encoding = self::getEncoding($encoding);
  44688. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  44689. self::$internalEncoding = $encoding;
  44690. return true;
  44691. }
  44692. return false;
  44693. }
  44694. public static function mb_language($lang = null)
  44695. {
  44696. if (null === $lang) {
  44697. return self::$language;
  44698. }
  44699. switch ($lang = strtolower($lang)) {
  44700. case 'uni':
  44701. case 'neutral':
  44702. self::$language = $lang;
  44703. return true;
  44704. }
  44705. return false;
  44706. }
  44707. public static function mb_list_encodings()
  44708. {
  44709. return array('UTF-8');
  44710. }
  44711. public static function mb_encoding_aliases($encoding)
  44712. {
  44713. switch (strtoupper($encoding)) {
  44714. case 'UTF8':
  44715. case 'UTF-8':
  44716. return array('utf8');
  44717. }
  44718. return false;
  44719. }
  44720. public static function mb_check_encoding($var = null, $encoding = null)
  44721. {
  44722. if (null === $encoding) {
  44723. if (null === $var) {
  44724. return false;
  44725. }
  44726. $encoding = self::$internalEncoding;
  44727. }
  44728. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  44729. }
  44730. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  44731. {
  44732. if (null === $encodingList) {
  44733. $encodingList = self::$encodingList;
  44734. } else {
  44735. if (!\is_array($encodingList)) {
  44736. $encodingList = array_map('trim', explode(',', $encodingList));
  44737. }
  44738. $encodingList = array_map('strtoupper', $encodingList);
  44739. }
  44740. foreach ($encodingList as $enc) {
  44741. switch ($enc) {
  44742. case 'ASCII':
  44743. if (!preg_match('/[\x80-\xFF]/', $str)) {
  44744. return $enc;
  44745. }
  44746. break;
  44747. case 'UTF8':
  44748. case 'UTF-8':
  44749. if (preg_match('//u', $str)) {
  44750. return 'UTF-8';
  44751. }
  44752. break;
  44753. default:
  44754. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  44755. return $enc;
  44756. }
  44757. }
  44758. }
  44759. return false;
  44760. }
  44761. public static function mb_detect_order($encodingList = null)
  44762. {
  44763. if (null === $encodingList) {
  44764. return self::$encodingList;
  44765. }
  44766. if (!\is_array($encodingList)) {
  44767. $encodingList = array_map('trim', explode(',', $encodingList));
  44768. }
  44769. $encodingList = array_map('strtoupper', $encodingList);
  44770. foreach ($encodingList as $enc) {
  44771. switch ($enc) {
  44772. default:
  44773. if (strncmp($enc, 'ISO-8859-', 9)) {
  44774. return false;
  44775. }
  44776. case 'ASCII':
  44777. case 'UTF8':
  44778. case 'UTF-8':
  44779. }
  44780. }
  44781. self::$encodingList = $encodingList;
  44782. return true;
  44783. }
  44784. public static function mb_strlen($s, $encoding = null)
  44785. {
  44786. $encoding = self::getEncoding($encoding);
  44787. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44788. return \strlen($s);
  44789. }
  44790. return @iconv_strlen($s, $encoding);
  44791. }
  44792. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  44793. {
  44794. $encoding = self::getEncoding($encoding);
  44795. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44796. return strpos($haystack, $needle, $offset);
  44797. }
  44798. $needle = (string) $needle;
  44799. if ('' === $needle) {
  44800. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  44801. return false;
  44802. }
  44803. return iconv_strpos($haystack, $needle, $offset, $encoding);
  44804. }
  44805. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  44806. {
  44807. $encoding = self::getEncoding($encoding);
  44808. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44809. return strrpos($haystack, $needle, $offset);
  44810. }
  44811. if ($offset != (int) $offset) {
  44812. $offset = 0;
  44813. } elseif ($offset = (int) $offset) {
  44814. if ($offset < 0) {
  44815. if (0 > $offset += self::mb_strlen($needle)) {
  44816. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  44817. }
  44818. $offset = 0;
  44819. } else {
  44820. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  44821. }
  44822. }
  44823. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44824. return false !== $pos ? $offset + $pos : false;
  44825. }
  44826. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  44827. {
  44828. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  44829. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  44830. return null;
  44831. }
  44832. if (1 > $split_length = (int) $split_length) {
  44833. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  44834. return false;
  44835. }
  44836. if (null === $encoding) {
  44837. $encoding = mb_internal_encoding();
  44838. }
  44839. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  44840. $rx = '/(';
  44841. while (65535 < $split_length) {
  44842. $rx .= '.{65535}';
  44843. $split_length -= 65535;
  44844. }
  44845. $rx .= '.{'.$split_length.'})/us';
  44846. return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  44847. }
  44848. $result = array();
  44849. $length = mb_strlen($string, $encoding);
  44850. for ($i = 0; $i < $length; $i += $split_length) {
  44851. $result[] = mb_substr($string, $i, $split_length, $encoding);
  44852. }
  44853. return $result;
  44854. }
  44855. public static function mb_strtolower($s, $encoding = null)
  44856. {
  44857. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  44858. }
  44859. public static function mb_strtoupper($s, $encoding = null)
  44860. {
  44861. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  44862. }
  44863. public static function mb_substitute_character($c = null)
  44864. {
  44865. if (0 === strcasecmp($c, 'none')) {
  44866. return true;
  44867. }
  44868. return null !== $c ? false : 'none';
  44869. }
  44870. public static function mb_substr($s, $start, $length = null, $encoding = null)
  44871. {
  44872. $encoding = self::getEncoding($encoding);
  44873. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44874. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  44875. }
  44876. if ($start < 0) {
  44877. $start = iconv_strlen($s, $encoding) + $start;
  44878. if ($start < 0) {
  44879. $start = 0;
  44880. }
  44881. }
  44882. if (null === $length) {
  44883. $length = 2147483647;
  44884. } elseif ($length < 0) {
  44885. $length = iconv_strlen($s, $encoding) + $length - $start;
  44886. if ($length < 0) {
  44887. return '';
  44888. }
  44889. }
  44890. return (string) iconv_substr($s, $start, $length, $encoding);
  44891. }
  44892. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  44893. {
  44894. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44895. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44896. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  44897. }
  44898. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  44899. {
  44900. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  44901. return self::getSubpart($pos, $part, $haystack, $encoding);
  44902. }
  44903. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  44904. {
  44905. $encoding = self::getEncoding($encoding);
  44906. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44907. return strrchr($haystack, $needle, $part);
  44908. }
  44909. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44910. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44911. return self::getSubpart($pos, $part, $haystack, $encoding);
  44912. }
  44913. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  44914. {
  44915. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44916. $pos = self::mb_strripos($haystack, $needle, $encoding);
  44917. return self::getSubpart($pos, $part, $haystack, $encoding);
  44918. }
  44919. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  44920. {
  44921. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44922. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44923. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  44924. }
  44925. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  44926. {
  44927. $pos = strpos($haystack, $needle);
  44928. if (false === $pos) {
  44929. return false;
  44930. }
  44931. if ($part) {
  44932. return substr($haystack, 0, $pos);
  44933. }
  44934. return substr($haystack, $pos);
  44935. }
  44936. public static function mb_get_info($type = 'all')
  44937. {
  44938. $info = array(
  44939. 'internal_encoding' => self::$internalEncoding,
  44940. 'http_output' => 'pass',
  44941. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  44942. 'func_overload' => 0,
  44943. 'func_overload_list' => 'no overload',
  44944. 'mail_charset' => 'UTF-8',
  44945. 'mail_header_encoding' => 'BASE64',
  44946. 'mail_body_encoding' => 'BASE64',
  44947. 'illegal_chars' => 0,
  44948. 'encoding_translation' => 'Off',
  44949. 'language' => self::$language,
  44950. 'detect_order' => self::$encodingList,
  44951. 'substitute_character' => 'none',
  44952. 'strict_detection' => 'Off',
  44953. );
  44954. if ('all' === $type) {
  44955. return $info;
  44956. }
  44957. if (isset($info[$type])) {
  44958. return $info[$type];
  44959. }
  44960. return false;
  44961. }
  44962. public static function mb_http_input($type = '')
  44963. {
  44964. return false;
  44965. }
  44966. public static function mb_http_output($encoding = null)
  44967. {
  44968. return null !== $encoding ? 'pass' === $encoding : 'pass';
  44969. }
  44970. public static function mb_strwidth($s, $encoding = null)
  44971. {
  44972. $encoding = self::getEncoding($encoding);
  44973. if ('UTF-8' !== $encoding) {
  44974. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44975. }
  44976. $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);
  44977. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  44978. }
  44979. public static function mb_substr_count($haystack, $needle, $encoding = null)
  44980. {
  44981. return substr_count($haystack, $needle);
  44982. }
  44983. public static function mb_output_handler($contents, $status)
  44984. {
  44985. return $contents;
  44986. }
  44987. public static function mb_chr($code, $encoding = null)
  44988. {
  44989. if (0x80 > $code %= 0x200000) {
  44990. $s = \chr($code);
  44991. } elseif (0x800 > $code) {
  44992. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  44993. } elseif (0x10000 > $code) {
  44994. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44995. } else {
  44996. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44997. }
  44998. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  44999. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  45000. }
  45001. return $s;
  45002. }
  45003. public static function mb_ord($s, $encoding = null)
  45004. {
  45005. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  45006. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  45007. }
  45008. if (1 === \strlen($s)) {
  45009. return \ord($s);
  45010. }
  45011. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  45012. if (0xF0 <= $code) {
  45013. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  45014. }
  45015. if (0xE0 <= $code) {
  45016. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  45017. }
  45018. if (0xC0 <= $code) {
  45019. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  45020. }
  45021. return $code;
  45022. }
  45023. private static function getSubpart($pos, $part, $haystack, $encoding)
  45024. {
  45025. if (false === $pos) {
  45026. return false;
  45027. }
  45028. if ($part) {
  45029. return self::mb_substr($haystack, 0, $pos, $encoding);
  45030. }
  45031. return self::mb_substr($haystack, $pos, null, $encoding);
  45032. }
  45033. private static function html_encoding_callback(array $m)
  45034. {
  45035. $i = 1;
  45036. $entities = '';
  45037. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  45038. while (isset($m[$i])) {
  45039. if (0x80 > $m[$i]) {
  45040. $entities .= \chr($m[$i++]);
  45041. continue;
  45042. }
  45043. if (0xF0 <= $m[$i]) {
  45044. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45045. } elseif (0xE0 <= $m[$i]) {
  45046. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45047. } else {
  45048. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  45049. }
  45050. $entities .= '&#'.$c.';';
  45051. }
  45052. return $entities;
  45053. }
  45054. private static function title_case(array $s)
  45055. {
  45056. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  45057. }
  45058. private static function getData($file)
  45059. {
  45060. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  45061. return require $file;
  45062. }
  45063. return false;
  45064. }
  45065. private static function getEncoding($encoding)
  45066. {
  45067. if (null === $encoding) {
  45068. return self::$internalEncoding;
  45069. }
  45070. if ('UTF-8' === $encoding) {
  45071. return 'UTF-8';
  45072. }
  45073. $encoding = strtoupper($encoding);
  45074. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  45075. return 'CP850';
  45076. }
  45077. if ('UTF8' === $encoding) {
  45078. return 'UTF-8';
  45079. }
  45080. return $encoding;
  45081. }
  45082. }
  45083. <?php
  45084. return array (
  45085. 'A' => 'a',
  45086. 'B' => 'b',
  45087. 'C' => 'c',
  45088. 'D' => 'd',
  45089. 'E' => 'e',
  45090. 'F' => 'f',
  45091. 'G' => 'g',
  45092. 'H' => 'h',
  45093. 'I' => 'i',
  45094. 'J' => 'j',
  45095. 'K' => 'k',
  45096. 'L' => 'l',
  45097. 'M' => 'm',
  45098. 'N' => 'n',
  45099. 'O' => 'o',
  45100. 'P' => 'p',
  45101. 'Q' => 'q',
  45102. 'R' => 'r',
  45103. 'S' => 's',
  45104. 'T' => 't',
  45105. 'U' => 'u',
  45106. 'V' => 'v',
  45107. 'W' => 'w',
  45108. 'X' => 'x',
  45109. 'Y' => 'y',
  45110. 'Z' => 'z',
  45111. 'À' => 'à',
  45112. '�' => 'á',
  45113. 'Â' => 'â',
  45114. 'Ã' => 'ã',
  45115. 'Ä' => 'ä',
  45116. 'Ã…' => 'Ã¥',
  45117. 'Æ' => 'æ',
  45118. 'Ç' => 'ç',
  45119. 'È' => 'è',
  45120. 'É' => 'é',
  45121. 'Ê' => 'ê',
  45122. 'Ë' => 'ë',
  45123. 'Ì' => 'ì',
  45124. '�' => 'í',
  45125. 'Î' => 'î',
  45126. '�' => 'ï',
  45127. '�' => 'ð',
  45128. 'Ñ' => 'ñ',
  45129. 'Ò' => 'ò',
  45130. 'Ó' => 'ó',
  45131. 'Ô' => 'ô',
  45132. 'Õ' => 'õ',
  45133. 'Ö' => 'ö',
  45134. 'Ø' => 'ø',
  45135. 'Ù' => 'ù',
  45136. 'Ú' => 'ú',
  45137. 'Û' => 'û',
  45138. 'Ü' => 'ü',
  45139. '�' => 'ý',
  45140. 'Þ' => 'þ',
  45141. 'Ā' => '�',
  45142. 'Ă' => 'ă',
  45143. 'Ä„' => 'Ä…',
  45144. 'Ć' => 'ć',
  45145. 'Ĉ' => 'ĉ',
  45146. 'ÄŠ' => 'Ä‹',
  45147. 'Č' => '�',
  45148. 'Ď' => '�',
  45149. '�' => 'đ',
  45150. 'Ä’' => 'Ä“',
  45151. 'Ä”' => 'Ä•',
  45152. 'Ä–' => 'Ä—',
  45153. 'Ę' => 'ę',
  45154. 'Äš' => 'Ä›',
  45155. 'Ĝ' => '�',
  45156. 'Äž' => 'ÄŸ',
  45157. 'Ä ' => 'Ä¡',
  45158. 'Ä¢' => 'Ä£',
  45159. 'Ĥ' => 'ĥ',
  45160. 'Ħ' => 'ħ',
  45161. 'Ĩ' => 'ĩ',
  45162. 'Ī' => 'ī',
  45163. 'Ĭ' => 'ĭ',
  45164. 'Į' => 'į',
  45165. 'Ä°' => 'i',
  45166. 'IJ' => 'ij',
  45167. 'Ĵ' => 'ĵ',
  45168. 'Ķ' => 'ķ',
  45169. 'Ĺ' => 'ĺ',
  45170. 'Ļ' => 'ļ',
  45171. 'Ľ' => 'ľ',
  45172. 'Ä¿' => 'Å€',
  45173. '�' => 'ł',
  45174. 'Ń' => 'ń',
  45175. 'Ņ' => 'ņ',
  45176. 'Ň' => 'ň',
  45177. 'ÅŠ' => 'Å‹',
  45178. 'Ō' => '�',
  45179. 'Ŏ' => '�',
  45180. '�' => 'ő',
  45181. 'Å’' => 'Å“',
  45182. 'Å”' => 'Å•',
  45183. 'Å–' => 'Å—',
  45184. 'Ř' => 'ř',
  45185. 'Åš' => 'Å›',
  45186. 'Ŝ' => '�',
  45187. 'Åž' => 'ÅŸ',
  45188. 'Å ' => 'Å¡',
  45189. 'Å¢' => 'Å£',
  45190. 'Ť' => 'ť',
  45191. 'Ŧ' => 'ŧ',
  45192. 'Ũ' => 'ũ',
  45193. 'Ū' => 'ū',
  45194. 'Ŭ' => 'ŭ',
  45195. 'Ů' => 'ů',
  45196. 'Ű' => 'ű',
  45197. 'Ų' => 'ų',
  45198. 'Ŵ' => 'ŵ',
  45199. 'Ŷ' => 'ŷ',
  45200. 'Ÿ' => 'ÿ',
  45201. 'Ź' => 'ź',
  45202. 'Ż' => 'ż',
  45203. 'Ž' => 'ž',
  45204. '�' => 'ɓ',
  45205. 'Ƃ' => 'ƃ',
  45206. 'Æ„' => 'Æ…',
  45207. 'Ɔ' => 'ɔ',
  45208. 'Ƈ' => 'ƈ',
  45209. 'Ɖ' => 'ɖ',
  45210. 'ÆŠ' => 'É—',
  45211. 'Ƌ' => 'ƌ',
  45212. 'Ǝ' => '�',
  45213. '�' => 'ə',
  45214. '�' => 'ɛ',
  45215. 'Æ‘' => 'Æ’',
  45216. 'Æ“' => 'É ',
  45217. 'Æ”' => 'É£',
  45218. 'Æ–' => 'É©',
  45219. 'Ɨ' => 'ɨ',
  45220. 'Ƙ' => 'ƙ',
  45221. 'Ɯ' => 'ɯ',
  45222. '�' => 'ɲ',
  45223. 'Ɵ' => 'ɵ',
  45224. 'Æ ' => 'Æ¡',
  45225. 'Æ¢' => 'Æ£',
  45226. 'Ƥ' => 'ƥ',
  45227. 'Ʀ' => 'ʀ',
  45228. 'Ƨ' => 'ƨ',
  45229. 'Ʃ' => 'ʃ',
  45230. 'Ƭ' => 'ƭ',
  45231. 'Ʈ' => 'ʈ',
  45232. 'Ư' => 'ư',
  45233. 'Ʊ' => 'ʊ',
  45234. 'Ʋ' => 'ʋ',
  45235. 'Ƴ' => 'ƴ',
  45236. 'Ƶ' => 'ƶ',
  45237. 'Æ·' => 'Ê’',
  45238. 'Ƹ' => 'ƹ',
  45239. 'Ƽ' => 'ƽ',
  45240. 'DŽ' => 'dž',
  45241. 'Dž' => 'dž',
  45242. 'LJ' => 'lj',
  45243. 'Lj' => 'lj',
  45244. 'NJ' => 'nj',
  45245. 'Nj' => 'nj',
  45246. '�' => 'ǎ',
  45247. '�' => '�',
  45248. 'Ç‘' => 'Ç’',
  45249. 'Ç“' => 'Ç”',
  45250. 'Ç•' => 'Ç–',
  45251. 'Ǘ' => 'ǘ',
  45252. 'Ç™' => 'Çš',
  45253. 'Ǜ' => 'ǜ',
  45254. 'Çž' => 'ÇŸ',
  45255. 'Ç ' => 'Ç¡',
  45256. 'Ç¢' => 'Ç£',
  45257. 'Ǥ' => 'ǥ',
  45258. 'Ǧ' => 'ǧ',
  45259. 'Ǩ' => 'ǩ',
  45260. 'Ǫ' => 'ǫ',
  45261. 'Ǭ' => 'ǭ',
  45262. 'Ǯ' => 'ǯ',
  45263. 'DZ' => 'dz',
  45264. 'Dz' => 'dz',
  45265. 'Ǵ' => 'ǵ',
  45266. 'Ƕ' => 'ƕ',
  45267. 'Ç·' => 'Æ¿',
  45268. 'Ǹ' => 'ǹ',
  45269. 'Ǻ' => 'ǻ',
  45270. 'Ǽ' => 'ǽ',
  45271. 'Ǿ' => 'ǿ',
  45272. 'Ȁ' => '�',
  45273. 'Ȃ' => 'ȃ',
  45274. 'È„' => 'È…',
  45275. 'Ȇ' => 'ȇ',
  45276. 'Ȉ' => 'ȉ',
  45277. 'ÈŠ' => 'È‹',
  45278. 'Ȍ' => '�',
  45279. 'Ȏ' => '�',
  45280. '�' => 'ȑ',
  45281. 'È’' => 'È“',
  45282. 'È”' => 'È•',
  45283. 'È–' => 'È—',
  45284. 'Ș' => 'ș',
  45285. 'Èš' => 'È›',
  45286. 'Ȝ' => '�',
  45287. 'Èž' => 'ÈŸ',
  45288. 'È ' => 'Æž',
  45289. 'È¢' => 'È£',
  45290. 'Ȥ' => 'ȥ',
  45291. 'Ȧ' => 'ȧ',
  45292. 'Ȩ' => 'ȩ',
  45293. 'Ȫ' => 'ȫ',
  45294. 'Ȭ' => 'ȭ',
  45295. 'Ȯ' => 'ȯ',
  45296. 'Ȱ' => 'ȱ',
  45297. 'Ȳ' => 'ȳ',
  45298. 'Ⱥ' => 'ⱥ',
  45299. 'Ȼ' => 'ȼ',
  45300. 'Ƚ' => 'ƚ',
  45301. 'Ⱦ' => 'ⱦ',
  45302. '�' => 'ɂ',
  45303. 'Ƀ' => 'ƀ',
  45304. 'Ʉ' => 'ʉ',
  45305. 'Ʌ' => 'ʌ',
  45306. 'Ɇ' => 'ɇ',
  45307. 'Ɉ' => 'ɉ',
  45308. 'ÉŠ' => 'É‹',
  45309. 'Ɍ' => '�',
  45310. 'Ɏ' => '�',
  45311. 'Ͱ' => 'ͱ',
  45312. 'Ͳ' => 'ͳ',
  45313. 'Ͷ' => 'ͷ',
  45314. 'Ϳ' => 'ϳ',
  45315. 'Ά' => 'ά',
  45316. 'Έ' => 'έ',
  45317. 'Ή' => 'ή',
  45318. 'Ί' => 'ί',
  45319. 'Ό' => 'ό',
  45320. 'Ύ' => '�',
  45321. '�' => 'ώ',
  45322. 'Α' => 'α',
  45323. 'Β' => 'β',
  45324. 'Γ' => 'γ',
  45325. 'Δ' => 'δ',
  45326. 'Ε' => 'ε',
  45327. 'Ζ' => 'ζ',
  45328. 'Η' => 'η',
  45329. 'Θ' => 'θ',
  45330. 'Ι' => 'ι',
  45331. 'Κ' => 'κ',
  45332. 'Λ' => 'λ',
  45333. 'Μ' => 'μ',
  45334. '�' => 'ν',
  45335. 'Ξ' => 'ξ',
  45336. 'Ο' => 'ο',
  45337. 'Π' => 'π',
  45338. 'Ρ' => '�',
  45339. 'Σ' => 'σ',
  45340. 'Τ' => 'τ',
  45341. 'Î¥' => 'Ï…',
  45342. 'Φ' => 'φ',
  45343. 'Χ' => 'χ',
  45344. 'Ψ' => 'ψ',
  45345. 'Ω' => 'ω',
  45346. 'Ϊ' => 'ϊ',
  45347. 'Ϋ' => 'ϋ',
  45348. '�' => 'ϗ',
  45349. 'Ϙ' => 'ϙ',
  45350. 'Ïš' => 'Ï›',
  45351. 'Ϝ' => '�',
  45352. 'Ïž' => 'ÏŸ',
  45353. 'Ï ' => 'Ï¡',
  45354. 'Ï¢' => 'Ï£',
  45355. 'Ϥ' => 'ϥ',
  45356. 'Ϧ' => 'ϧ',
  45357. 'Ϩ' => 'ϩ',
  45358. 'Ϫ' => 'ϫ',
  45359. 'Ϭ' => 'ϭ',
  45360. 'Ϯ' => 'ϯ',
  45361. 'ϴ' => 'θ',
  45362. 'Ϸ' => 'ϸ',
  45363. 'Ϲ' => 'ϲ',
  45364. 'Ϻ' => 'ϻ',
  45365. 'Ͻ' => 'ͻ',
  45366. 'Ͼ' => 'ͼ',
  45367. 'Ͽ' => 'ͽ',
  45368. 'Ѐ' => '�',
  45369. '�' => 'ё',
  45370. 'Ђ' => 'ђ',
  45371. 'Ѓ' => 'ѓ',
  45372. 'Є' => 'є',
  45373. 'Ð…' => 'Ñ•',
  45374. 'І' => 'і',
  45375. 'Ї' => 'ї',
  45376. 'Ј' => 'ј',
  45377. 'Љ' => 'љ',
  45378. 'Њ' => 'њ',
  45379. 'Ћ' => 'ћ',
  45380. 'Ќ' => 'ќ',
  45381. '�' => '�',
  45382. 'ÐŽ' => 'Ñž',
  45383. '�' => 'џ',
  45384. '�' => 'а',
  45385. 'Б' => 'б',
  45386. 'В' => 'в',
  45387. 'Г' => 'г',
  45388. 'Д' => 'д',
  45389. 'Е' => 'е',
  45390. 'Ж' => 'ж',
  45391. 'З' => 'з',
  45392. 'И' => 'и',
  45393. 'Й' => 'й',
  45394. 'К' => 'к',
  45395. 'Л' => 'л',
  45396. 'М' => 'м',
  45397. '�' => 'н',
  45398. 'О' => 'о',
  45399. 'П' => 'п',
  45400. 'Р' => 'р',
  45401. 'С' => '�',
  45402. 'Т' => 'т',
  45403. 'У' => 'у',
  45404. 'Ф' => 'ф',
  45405. 'Ð¥' => 'Ñ…',
  45406. 'Ц' => 'ц',
  45407. 'Ч' => 'ч',
  45408. 'Ш' => 'ш',
  45409. 'Щ' => 'щ',
  45410. 'Ъ' => 'ъ',
  45411. 'Ы' => 'ы',
  45412. 'Ь' => 'ь',
  45413. 'Э' => '�',
  45414. 'Ю' => 'ю',
  45415. 'Я' => '�',
  45416. 'Ñ ' => 'Ñ¡',
  45417. 'Ñ¢' => 'Ñ£',
  45418. 'Ѥ' => 'ѥ',
  45419. 'Ѧ' => 'ѧ',
  45420. 'Ѩ' => 'ѩ',
  45421. 'Ѫ' => 'ѫ',
  45422. 'Ѭ' => 'ѭ',
  45423. 'Ѯ' => 'ѯ',
  45424. 'Ѱ' => 'ѱ',
  45425. 'Ѳ' => 'ѳ',
  45426. 'Ѵ' => 'ѵ',
  45427. 'Ѷ' => 'ѷ',
  45428. 'Ѹ' => 'ѹ',
  45429. 'Ѻ' => 'ѻ',
  45430. 'Ѽ' => 'ѽ',
  45431. 'Ѿ' => 'ѿ',
  45432. 'Ò€' => 'Ò�',
  45433. 'ÒŠ' => 'Ò‹',
  45434. 'Ҍ' => '�',
  45435. 'ÒŽ' => 'Ò�',
  45436. 'Ò�' => 'Ò‘',
  45437. 'Ò’' => 'Ò“',
  45438. 'Ò”' => 'Ò•',
  45439. 'Ò–' => 'Ò—',
  45440. 'Ò˜' => 'Ò™',
  45441. 'Òš' => 'Ò›',
  45442. 'Ҝ' => '�',
  45443. 'Òž' => 'ÒŸ',
  45444. 'Ò ' => 'Ò¡',
  45445. 'Ò¢' => 'Ò£',
  45446. 'Ò¤' => 'Ò¥',
  45447. 'Ò¦' => 'Ò§',
  45448. 'Ò¨' => 'Ò©',
  45449. 'Òª' => 'Ò«',
  45450. 'Ò¬' => 'Ò­',
  45451. 'Ò®' => 'Ò¯',
  45452. 'Ò°' => 'Ò±',
  45453. 'Ò²' => 'Ò³',
  45454. 'Ò´' => 'Òµ',
  45455. 'Ò¶' => 'Ò·',
  45456. 'Ò¸' => 'Ò¹',
  45457. 'Òº' => 'Ò»',
  45458. 'Ò¼' => 'Ò½',
  45459. 'Ò¾' => 'Ò¿',
  45460. 'Ó€' => 'Ó�',
  45461. 'Ó�' => 'Ó‚',
  45462. 'Óƒ' => 'Ó„',
  45463. 'Ó…' => 'Ó†',
  45464. 'Ó‡' => 'Óˆ',
  45465. 'Ó‰' => 'ÓŠ',
  45466. 'Ӌ' => 'ӌ',
  45467. 'Ó�' => 'ÓŽ',
  45468. 'Ó�' => 'Ó‘',
  45469. 'Ó’' => 'Ó“',
  45470. 'Ó”' => 'Ó•',
  45471. 'Ó–' => 'Ó—',
  45472. 'Ó˜' => 'Ó™',
  45473. 'Óš' => 'Ó›',
  45474. 'Ӝ' => '�',
  45475. 'Óž' => 'ÓŸ',
  45476. 'Ó ' => 'Ó¡',
  45477. 'Ó¢' => 'Ó£',
  45478. 'Ó¤' => 'Ó¥',
  45479. 'Ó¦' => 'Ó§',
  45480. 'Ó¨' => 'Ó©',
  45481. 'Óª' => 'Ó«',
  45482. 'Ó¬' => 'Ó­',
  45483. 'Ó®' => 'Ó¯',
  45484. 'Ó°' => 'Ó±',
  45485. 'Ó²' => 'Ó³',
  45486. 'Ó´' => 'Óµ',
  45487. 'Ó¶' => 'Ó·',
  45488. 'Ó¸' => 'Ó¹',
  45489. 'Óº' => 'Ó»',
  45490. 'Ó¼' => 'Ó½',
  45491. 'Ó¾' => 'Ó¿',
  45492. 'Ô€' => 'Ô�',
  45493. 'Ô‚' => 'Ôƒ',
  45494. 'Ô„' => 'Ô…',
  45495. 'Ô†' => 'Ô‡',
  45496. 'Ôˆ' => 'Ô‰',
  45497. 'ÔŠ' => 'Ô‹',
  45498. 'Ԍ' => '�',
  45499. 'ÔŽ' => 'Ô�',
  45500. 'Ô�' => 'Ô‘',
  45501. 'Ô’' => 'Ô“',
  45502. 'Ô”' => 'Ô•',
  45503. 'Ô–' => 'Ô—',
  45504. 'Ô˜' => 'Ô™',
  45505. 'Ôš' => 'Ô›',
  45506. 'Ԝ' => '�',
  45507. 'Ôž' => 'ÔŸ',
  45508. 'Ô ' => 'Ô¡',
  45509. 'Ô¢' => 'Ô£',
  45510. 'Ô¤' => 'Ô¥',
  45511. 'Ô¦' => 'Ô§',
  45512. 'Ô¨' => 'Ô©',
  45513. 'Ôª' => 'Ô«',
  45514. 'Ô¬' => 'Ô­',
  45515. 'Ô®' => 'Ô¯',
  45516. 'Ô±' => 'Õ¡',
  45517. 'Ô²' => 'Õ¢',
  45518. 'Ô³' => 'Õ£',
  45519. 'Ô´' => 'Õ¤',
  45520. 'Ôµ' => 'Õ¥',
  45521. 'Ô¶' => 'Õ¦',
  45522. 'Ô·' => 'Õ§',
  45523. 'Ô¸' => 'Õ¨',
  45524. 'Ô¹' => 'Õ©',
  45525. 'Ôº' => 'Õª',
  45526. 'Ô»' => 'Õ«',
  45527. 'Ô¼' => 'Õ¬',
  45528. 'Ô½' => 'Õ­',
  45529. 'Ô¾' => 'Õ®',
  45530. 'Ô¿' => 'Õ¯',
  45531. 'Õ€' => 'Õ°',
  45532. 'Õ�' => 'Õ±',
  45533. 'Õ‚' => 'Õ²',
  45534. 'Õƒ' => 'Õ³',
  45535. 'Õ„' => 'Õ´',
  45536. 'Õ…' => 'Õµ',
  45537. 'Õ†' => 'Õ¶',
  45538. 'Õ‡' => 'Õ·',
  45539. 'Õˆ' => 'Õ¸',
  45540. 'Õ‰' => 'Õ¹',
  45541. 'ÕŠ' => 'Õº',
  45542. 'Õ‹' => 'Õ»',
  45543. 'Ռ' => 'ռ',
  45544. 'Õ�' => 'Õ½',
  45545. 'ÕŽ' => 'Õ¾',
  45546. 'Õ�' => 'Õ¿',
  45547. 'Õ�' => 'Ö€',
  45548. 'Õ‘' => 'Ö�',
  45549. 'Õ’' => 'Ö‚',
  45550. 'Õ“' => 'Öƒ',
  45551. 'Õ”' => 'Ö„',
  45552. 'Õ•' => 'Ö…',
  45553. 'Õ–' => 'Ö†',
  45554. 'á‚ ' => 'â´€',
  45555. 'á‚¡' => 'â´�',
  45556. 'á‚¢' => 'â´‚',
  45557. 'á‚£' => 'â´ƒ',
  45558. 'Ⴄ' => 'ⴄ',
  45559. 'á‚¥' => 'â´…',
  45560. 'Ⴆ' => 'ⴆ',
  45561. 'Ⴇ' => 'ⴇ',
  45562. 'Ⴈ' => 'ⴈ',
  45563. 'á‚©' => 'â´‰',
  45564. 'Ⴊ' => 'ⴊ',
  45565. 'á‚«' => 'â´‹',
  45566. 'Ⴌ' => 'ⴌ',
  45567. 'á‚­' => 'â´�',
  45568. 'á‚®' => 'â´Ž',
  45569. 'Ⴏ' => '�',
  45570. 'á‚°' => 'â´�',
  45571. 'Ⴑ' => 'ⴑ',
  45572. 'Ⴒ' => 'ⴒ',
  45573. 'Ⴓ' => 'ⴓ',
  45574. 'á‚´' => 'â´”',
  45575. 'Ⴕ' => 'ⴕ',
  45576. 'Ⴖ' => 'ⴖ',
  45577. 'á‚·' => 'â´—',
  45578. 'Ⴘ' => 'ⴘ',
  45579. 'Ⴙ' => 'ⴙ',
  45580. 'Ⴚ' => 'ⴚ',
  45581. 'á‚»' => 'â´›',
  45582. 'Ⴜ' => 'ⴜ',
  45583. 'Ⴝ' => '�',
  45584. 'Ⴞ' => 'ⴞ',
  45585. 'á‚¿' => 'â´Ÿ',
  45586. 'Ⴠ' => 'ⴠ',
  45587. '�' => 'ⴡ',
  45588. 'Ⴢ' => 'ⴢ',
  45589. 'Ⴣ' => 'ⴣ',
  45590. 'Ⴤ' => 'ⴤ',
  45591. 'Ⴥ' => 'ⴥ',
  45592. 'Ⴧ' => 'ⴧ',
  45593. '�' => 'ⴭ',
  45594. 'Ꭰ' => 'ꭰ',
  45595. 'Ꭱ' => 'ꭱ',
  45596. 'Ꭲ' => 'ꭲ',
  45597. 'Ꭳ' => 'ꭳ',
  45598. 'Ꭴ' => 'ꭴ',
  45599. 'Ꭵ' => 'ꭵ',
  45600. 'Ꭶ' => 'ꭶ',
  45601. 'Ꭷ' => 'ꭷ',
  45602. 'Ꭸ' => 'ꭸ',
  45603. 'Ꭹ' => 'ꭹ',
  45604. 'Ꭺ' => 'ꭺ',
  45605. 'Ꭻ' => 'ꭻ',
  45606. 'Ꭼ' => 'ꭼ',
  45607. 'Ꭽ' => 'ꭽ',
  45608. 'Ꭾ' => 'ꭾ',
  45609. 'Ꭿ' => 'ꭿ',
  45610. 'Ꮀ' => 'ꮀ',
  45611. 'Ꮁ' => '�',
  45612. 'Ꮂ' => 'ꮂ',
  45613. 'Ꮃ' => 'ꮃ',
  45614. 'Ꮄ' => 'ꮄ',
  45615. 'Ꮅ' => 'ꮅ',
  45616. 'Ꮆ' => 'ꮆ',
  45617. 'Ꮇ' => 'ꮇ',
  45618. 'Ꮈ' => 'ꮈ',
  45619. 'Ꮉ' => 'ꮉ',
  45620. 'Ꮊ' => 'ꮊ',
  45621. 'Ꮋ' => 'ꮋ',
  45622. 'Ꮌ' => 'ꮌ',
  45623. 'Ꮍ' => '�',
  45624. 'Ꮎ' => 'ꮎ',
  45625. 'Ꮏ' => '�',
  45626. '�' => '�',
  45627. '�' => 'ꮑ',
  45628. '�' => 'ꮒ',
  45629. '�' => 'ꮓ',
  45630. '�' => 'ꮔ',
  45631. '�' => 'ꮕ',
  45632. '�' => 'ꮖ',
  45633. '�' => 'ꮗ',
  45634. '�' => 'ꮘ',
  45635. '�' => 'ꮙ',
  45636. '�' => 'ꮚ',
  45637. '�' => 'ꮛ',
  45638. '�' => 'ꮜ',
  45639. '�' => '�',
  45640. '�' => 'ꮞ',
  45641. '�' => 'ꮟ',
  45642. '�' => 'ꮠ',
  45643. '�' => 'ꮡ',
  45644. '�' => 'ꮢ',
  45645. '�' => 'ꮣ',
  45646. '�' => 'ꮤ',
  45647. '�' => 'ꮥ',
  45648. '�' => 'ꮦ',
  45649. '�' => 'ꮧ',
  45650. '�' => 'ꮨ',
  45651. '�' => 'ꮩ',
  45652. '�' => 'ꮪ',
  45653. '�' => 'ꮫ',
  45654. '�' => 'ꮬ',
  45655. '�' => 'ꮭ',
  45656. '�' => 'ꮮ',
  45657. '�' => 'ꮯ',
  45658. '�' => 'ꮰ',
  45659. '�' => 'ꮱ',
  45660. '�' => 'ꮲ',
  45661. '�' => 'ꮳ',
  45662. '�' => 'ꮴ',
  45663. '�' => 'ꮵ',
  45664. '�' => 'ꮶ',
  45665. '�' => 'ꮷ',
  45666. '�' => 'ꮸ',
  45667. '�' => 'ꮹ',
  45668. '�' => 'ꮺ',
  45669. '�' => 'ꮻ',
  45670. '�' => 'ꮼ',
  45671. '�' => 'ꮽ',
  45672. '�' => 'ꮾ',
  45673. '�' => 'ꮿ',
  45674. '�' => '�',
  45675. '�' => '�',
  45676. '�' => '�',
  45677. '�' => '�',
  45678. '�' => '�',
  45679. '�' => '�',
  45680. '�' => '�',
  45681. 'Ბ' => 'ბ',
  45682. 'Გ' => 'გ',
  45683. 'Დ' => 'დ',
  45684. 'Ე' => 'ე',
  45685. 'Ვ' => 'ვ',
  45686. 'Ზ' => 'ზ',
  45687. 'Თ' => 'თ',
  45688. 'Ი' => 'ი',
  45689. 'Კ' => 'კ',
  45690. 'Ლ' => 'ლ',
  45691. 'Მ' => 'მ',
  45692. 'Ნ' => 'ნ',
  45693. '�' => '�',
  45694. 'Პ' => 'პ',
  45695. 'Ჟ' => 'ჟ',
  45696. 'Რ' => 'რ',
  45697. 'Ს' => 'ს',
  45698. 'Ტ' => 'ტ',
  45699. 'Უ' => 'უ',
  45700. 'Ფ' => 'ფ',
  45701. 'Ქ' => 'ქ',
  45702. 'Ღ' => 'ღ',
  45703. 'Ყ' => 'ყ',
  45704. 'Შ' => 'შ',
  45705. 'Ჩ' => 'ჩ',
  45706. 'Ც' => 'ც',
  45707. 'Ძ' => 'ძ',
  45708. 'Წ' => 'წ',
  45709. 'Ჭ' => 'ჭ',
  45710. 'Ხ' => 'ხ',
  45711. 'Ჯ' => 'ჯ',
  45712. 'Ჰ' => 'ჰ',
  45713. 'Ჱ' => 'ჱ',
  45714. 'Ჲ' => 'ჲ',
  45715. 'Ჳ' => 'ჳ',
  45716. 'Ჴ' => 'ჴ',
  45717. 'Ჵ' => 'ჵ',
  45718. 'Ჶ' => 'ჶ',
  45719. 'Ჷ' => 'ჷ',
  45720. 'Ჸ' => 'ჸ',
  45721. 'Ჹ' => 'ჹ',
  45722. 'Ჺ' => 'ჺ',
  45723. 'Ჽ' => 'ჽ',
  45724. 'Ჾ' => 'ჾ',
  45725. 'Ჿ' => 'ჿ',
  45726. 'Ḁ' => '�',
  45727. 'Ḃ' => 'ḃ',
  45728. 'Ḅ' => 'ḅ',
  45729. 'Ḇ' => 'ḇ',
  45730. 'Ḉ' => 'ḉ',
  45731. 'Ḋ' => 'ḋ',
  45732. 'Ḍ' => '�',
  45733. 'Ḏ' => '�',
  45734. '�' => 'ḑ',
  45735. 'Ḓ' => 'ḓ',
  45736. 'Ḕ' => 'ḕ',
  45737. 'Ḗ' => 'ḗ',
  45738. 'Ḙ' => 'ḙ',
  45739. 'Ḛ' => 'ḛ',
  45740. 'Ḝ' => '�',
  45741. 'Ḟ' => 'ḟ',
  45742. 'Ḡ' => 'ḡ',
  45743. 'Ḣ' => 'ḣ',
  45744. 'Ḥ' => 'ḥ',
  45745. 'Ḧ' => 'ḧ',
  45746. 'Ḩ' => 'ḩ',
  45747. 'Ḫ' => 'ḫ',
  45748. 'Ḭ' => 'ḭ',
  45749. 'Ḯ' => 'ḯ',
  45750. 'Ḱ' => 'ḱ',
  45751. 'Ḳ' => 'ḳ',
  45752. 'Ḵ' => 'ḵ',
  45753. 'Ḷ' => 'ḷ',
  45754. 'Ḹ' => 'ḹ',
  45755. 'Ḻ' => 'ḻ',
  45756. 'Ḽ' => 'ḽ',
  45757. 'Ḿ' => 'ḿ',
  45758. 'Ṁ' => '�',
  45759. 'Ṃ' => 'ṃ',
  45760. 'Ṅ' => 'ṅ',
  45761. 'Ṇ' => 'ṇ',
  45762. 'Ṉ' => 'ṉ',
  45763. 'Ṋ' => 'ṋ',
  45764. 'Ṍ' => '�',
  45765. 'Ṏ' => '�',
  45766. '�' => 'ṑ',
  45767. 'Ṓ' => 'ṓ',
  45768. 'Ṕ' => 'ṕ',
  45769. 'á¹–' => 'á¹—',
  45770. 'Ṙ' => 'ṙ',
  45771. 'Ṛ' => 'ṛ',
  45772. 'Ṝ' => '�',
  45773. 'Ṟ' => 'ṟ',
  45774. 'Ṡ' => 'ṡ',
  45775. 'á¹¢' => 'á¹£',
  45776. 'Ṥ' => 'ṥ',
  45777. 'Ṧ' => 'ṧ',
  45778. 'Ṩ' => 'ṩ',
  45779. 'Ṫ' => 'ṫ',
  45780. 'Ṭ' => 'ṭ',
  45781. 'Ṯ' => 'ṯ',
  45782. 'á¹°' => 'á¹±',
  45783. 'á¹²' => 'á¹³',
  45784. 'á¹´' => 'á¹µ',
  45785. 'Ṷ' => 'ṷ',
  45786. 'Ṹ' => 'ṹ',
  45787. 'Ṻ' => 'ṻ',
  45788. 'á¹¼' => 'á¹½',
  45789. 'Ṿ' => 'ṿ',
  45790. 'Ẁ' => '�',
  45791. 'Ẃ' => 'ẃ',
  45792. 'Ẅ' => 'ẅ',
  45793. 'Ẇ' => 'ẇ',
  45794. 'Ẉ' => 'ẉ',
  45795. 'Ẋ' => 'ẋ',
  45796. 'Ẍ' => '�',
  45797. 'Ẏ' => '�',
  45798. '�' => 'ẑ',
  45799. 'Ẓ' => 'ẓ',
  45800. 'Ẕ' => 'ẕ',
  45801. 'ẞ' => 'ß',
  45802. 'Ạ' => 'ạ',
  45803. 'Ả' => 'ả',
  45804. 'Ấ' => 'ấ',
  45805. 'Ầ' => 'ầ',
  45806. 'Ẩ' => 'ẩ',
  45807. 'Ẫ' => 'ẫ',
  45808. 'Ậ' => 'ậ',
  45809. 'Ắ' => 'ắ',
  45810. 'Ằ' => 'ằ',
  45811. 'Ẳ' => 'ẳ',
  45812. 'Ẵ' => 'ẵ',
  45813. 'Ặ' => 'ặ',
  45814. 'Ẹ' => 'ẹ',
  45815. 'Ẻ' => 'ẻ',
  45816. 'Ẽ' => 'ẽ',
  45817. 'Ế' => 'ế',
  45818. 'Ề' => '�',
  45819. 'Ể' => 'ể',
  45820. 'Ễ' => 'ễ',
  45821. 'Ệ' => 'ệ',
  45822. 'Ỉ' => 'ỉ',
  45823. 'Ị' => 'ị',
  45824. 'Ọ' => '�',
  45825. 'Ỏ' => '�',
  45826. '�' => 'ố',
  45827. 'Ồ' => 'ồ',
  45828. 'Ổ' => 'ổ',
  45829. 'á»–' => 'á»—',
  45830. 'Ộ' => 'ộ',
  45831. 'Ớ' => 'ớ',
  45832. 'Ờ' => '�',
  45833. 'Ở' => 'ở',
  45834. 'Ỡ' => 'ỡ',
  45835. 'Ợ' => 'ợ',
  45836. 'Ụ' => 'ụ',
  45837. 'Ủ' => 'ủ',
  45838. 'Ứ' => 'ứ',
  45839. 'Ừ' => 'ừ',
  45840. 'Ử' => 'ử',
  45841. 'Ữ' => 'ữ',
  45842. 'á»°' => 'á»±',
  45843. 'Ỳ' => 'ỳ',
  45844. 'Ỵ' => 'ỵ',
  45845. 'Ỷ' => 'ỷ',
  45846. 'Ỹ' => 'ỹ',
  45847. 'Ỻ' => 'ỻ',
  45848. 'Ỽ' => 'ỽ',
  45849. 'Ỿ' => 'ỿ',
  45850. 'Ἀ' => 'ἀ',
  45851. 'Ἁ' => '�',
  45852. 'Ἂ' => 'ἂ',
  45853. 'Ἃ' => 'ἃ',
  45854. 'Ἄ' => 'ἄ',
  45855. '�' => 'ἅ',
  45856. 'Ἆ' => 'ἆ',
  45857. '�' => 'ἇ',
  45858. 'Ἐ' => '�',
  45859. 'Ἑ' => 'ἑ',
  45860. 'Ἒ' => 'ἒ',
  45861. 'Ἓ' => 'ἓ',
  45862. 'Ἔ' => 'ἔ',
  45863. '�' => 'ἕ',
  45864. 'Ἠ' => 'ἠ',
  45865. 'Ἡ' => 'ἡ',
  45866. 'Ἢ' => 'ἢ',
  45867. 'Ἣ' => 'ἣ',
  45868. 'Ἤ' => 'ἤ',
  45869. 'á¼­' => 'á¼¥',
  45870. 'Ἦ' => 'ἦ',
  45871. 'Ἧ' => 'ἧ',
  45872. 'Ἰ' => 'ἰ',
  45873. 'á¼¹' => 'á¼±',
  45874. 'Ἲ' => 'ἲ',
  45875. 'á¼»' => 'á¼³',
  45876. 'á¼¼' => 'á¼´',
  45877. 'á¼½' => 'á¼µ',
  45878. 'Ἶ' => 'ἶ',
  45879. 'Ἷ' => 'ἷ',
  45880. 'Ὀ' => 'ὀ',
  45881. 'Ὁ' => '�',
  45882. 'Ὂ' => 'ὂ',
  45883. 'Ὃ' => 'ὃ',
  45884. 'Ὄ' => 'ὄ',
  45885. '�' => 'ὅ',
  45886. 'Ὑ' => 'ὑ',
  45887. 'Ὓ' => 'ὓ',
  45888. '�' => 'ὕ',
  45889. 'Ὗ' => 'ὗ',
  45890. 'Ὠ' => 'ὠ',
  45891. 'Ὡ' => 'ὡ',
  45892. 'Ὢ' => 'ὢ',
  45893. 'Ὣ' => 'ὣ',
  45894. 'Ὤ' => 'ὤ',
  45895. 'á½­' => 'á½¥',
  45896. 'Ὦ' => 'ὦ',
  45897. 'Ὧ' => 'ὧ',
  45898. 'ᾈ' => 'ᾀ',
  45899. 'ᾉ' => '�',
  45900. 'ᾊ' => 'ᾂ',
  45901. 'ᾋ' => 'ᾃ',
  45902. 'ᾌ' => 'ᾄ',
  45903. '�' => 'ᾅ',
  45904. 'ᾎ' => 'ᾆ',
  45905. '�' => 'ᾇ',
  45906. 'ᾘ' => '�',
  45907. 'ᾙ' => 'ᾑ',
  45908. 'ᾚ' => 'ᾒ',
  45909. 'ᾛ' => 'ᾓ',
  45910. 'ᾜ' => 'ᾔ',
  45911. '�' => 'ᾕ',
  45912. 'ᾞ' => 'ᾖ',
  45913. 'ᾟ' => 'ᾗ',
  45914. 'ᾨ' => 'ᾠ',
  45915. 'ᾩ' => 'ᾡ',
  45916. 'ᾪ' => 'ᾢ',
  45917. 'ᾫ' => 'ᾣ',
  45918. 'ᾬ' => 'ᾤ',
  45919. 'á¾­' => 'á¾¥',
  45920. 'ᾮ' => 'ᾦ',
  45921. 'ᾯ' => 'ᾧ',
  45922. 'Ᾰ' => 'ᾰ',
  45923. 'á¾¹' => 'á¾±',
  45924. 'Ὰ' => 'ὰ',
  45925. 'á¾»' => 'á½±',
  45926. 'á¾¼' => 'á¾³',
  45927. 'Ὲ' => 'ὲ',
  45928. 'Έ' => 'έ',
  45929. 'á¿Š' => 'á½´',
  45930. 'á¿‹' => 'á½µ',
  45931. 'ῌ' => 'ῃ',
  45932. 'Ῐ' => '�',
  45933. 'á¿™' => 'á¿‘',
  45934. 'Ὶ' => 'ὶ',
  45935. 'á¿›' => 'á½·',
  45936. 'Ῠ' => 'ῠ',
  45937. 'á¿©' => 'á¿¡',
  45938. 'Ὺ' => 'ὺ',
  45939. 'á¿«' => 'á½»',
  45940. 'Ῥ' => 'ῥ',
  45941. 'Ὸ' => 'ὸ',
  45942. 'Ό' => 'ό',
  45943. 'Ὼ' => 'ὼ',
  45944. 'á¿»' => 'á½½',
  45945. 'ῼ' => 'ῳ',
  45946. 'Ω' => 'ω',
  45947. 'K' => 'k',
  45948. 'â„«' => 'Ã¥',
  45949. 'Ⅎ' => 'ⅎ',
  45950. 'â… ' => 'â…°',
  45951. 'â…¡' => 'â…±',
  45952. 'â…¢' => 'â…²',
  45953. 'â…£' => 'â…³',
  45954. 'â…¤' => 'â…´',
  45955. 'â…¥' => 'â…µ',
  45956. 'â…¦' => 'â…¶',
  45957. 'â…§' => 'â…·',
  45958. 'â…¨' => 'â…¸',
  45959. 'â…©' => 'â…¹',
  45960. 'â…ª' => 'â…º',
  45961. 'â…«' => 'â…»',
  45962. 'â…¬' => 'â…¼',
  45963. 'â…­' => 'â…½',
  45964. 'â…®' => 'â…¾',
  45965. 'â…¯' => 'â…¿',
  45966. 'Ↄ' => 'ↄ',
  45967. 'Ⓐ' => '�',
  45968. 'â’·' => 'â“‘',
  45969. 'â’¸' => 'â“’',
  45970. 'â’¹' => 'â““',
  45971. 'â’º' => 'â“”',
  45972. 'â’»' => 'â“•',
  45973. 'â’¼' => 'â“–',
  45974. 'â’½' => 'â“—',
  45975. 'Ⓘ' => 'ⓘ',
  45976. 'â’¿' => 'â“™',
  45977. 'â“€' => 'â“š',
  45978. '�' => 'ⓛ',
  45979. 'Ⓜ' => 'ⓜ',
  45980. 'Ⓝ' => '�',
  45981. 'â“„' => 'â“ž',
  45982. 'â“…' => 'â“Ÿ',
  45983. 'Ⓠ' => 'ⓠ',
  45984. 'Ⓡ' => 'ⓡ',
  45985. 'Ⓢ' => 'ⓢ',
  45986. 'Ⓣ' => 'ⓣ',
  45987. 'Ⓤ' => 'ⓤ',
  45988. 'â“‹' => 'â“¥',
  45989. 'Ⓦ' => 'ⓦ',
  45990. '�' => 'ⓧ',
  45991. 'Ⓨ' => 'ⓨ',
  45992. '�' => 'ⓩ',
  45993. 'â°€' => 'â°°',
  45994. 'â°�' => 'â°±',
  45995. 'â°‚' => 'â°²',
  45996. 'â°ƒ' => 'â°³',
  45997. 'â°„' => 'â°´',
  45998. 'â°…' => 'â°µ',
  45999. 'â°†' => 'â°¶',
  46000. 'â°‡' => 'â°·',
  46001. 'â°ˆ' => 'â°¸',
  46002. 'â°‰' => 'â°¹',
  46003. 'â°Š' => 'â°º',
  46004. 'â°‹' => 'â°»',
  46005. 'Ⰼ' => 'ⰼ',
  46006. 'â°�' => 'â°½',
  46007. 'â°Ž' => 'â°¾',
  46008. 'â°�' => 'â°¿',
  46009. 'â°�' => 'â±€',
  46010. 'Ⱁ' => '�',
  46011. 'Ⱂ' => 'ⱂ',
  46012. 'Ⱃ' => 'ⱃ',
  46013. 'Ⱄ' => 'ⱄ',
  46014. 'â°•' => 'â±…',
  46015. 'Ⱆ' => 'ⱆ',
  46016. 'Ⱇ' => 'ⱇ',
  46017. 'Ⱈ' => 'ⱈ',
  46018. 'Ⱉ' => 'ⱉ',
  46019. 'Ⱊ' => 'ⱊ',
  46020. 'Ⱋ' => 'ⱋ',
  46021. 'Ⱌ' => 'ⱌ',
  46022. '�' => '�',
  46023. 'Ⱎ' => 'ⱎ',
  46024. 'Ⱏ' => '�',
  46025. 'Ⱐ' => '�',
  46026. 'Ⱑ' => 'ⱑ',
  46027. 'â°¢' => 'â±’',
  46028. 'Ⱓ' => 'ⱓ',
  46029. 'â°¤' => 'â±”',
  46030. 'Ⱕ' => 'ⱕ',
  46031. 'â°¦' => 'â±–',
  46032. 'â°§' => 'â±—',
  46033. 'Ⱘ' => 'ⱘ',
  46034. 'â°©' => 'â±™',
  46035. 'Ⱚ' => 'ⱚ',
  46036. 'â°«' => 'â±›',
  46037. 'Ⱜ' => 'ⱜ',
  46038. 'Ⱝ' => '�',
  46039. 'Ⱞ' => 'ⱞ',
  46040. 'Ⱡ' => 'ⱡ',
  46041. 'â±¢' => 'É«',
  46042. 'â±£' => 'áµ½',
  46043. 'Ɽ' => 'ɽ',
  46044. 'Ⱨ' => 'ⱨ',
  46045. 'Ⱪ' => 'ⱪ',
  46046. 'Ⱬ' => 'ⱬ',
  46047. 'â±­' => 'É‘',
  46048. 'Ɱ' => 'ɱ',
  46049. 'Ɐ' => '�',
  46050. 'â±°' => 'É’',
  46051. 'â±²' => 'â±³',
  46052. 'Ⱶ' => 'ⱶ',
  46053. 'â±¾' => 'È¿',
  46054. 'Ɀ' => 'ɀ',
  46055. 'Ⲁ' => '�',
  46056. 'Ⲃ' => 'ⲃ',
  46057. 'Ⲅ' => 'ⲅ',
  46058. 'Ⲇ' => 'ⲇ',
  46059. 'Ⲉ' => 'ⲉ',
  46060. 'Ⲋ' => 'ⲋ',
  46061. 'Ⲍ' => '�',
  46062. 'Ⲏ' => '�',
  46063. '�' => 'ⲑ',
  46064. 'Ⲓ' => 'ⲓ',
  46065. 'Ⲕ' => 'ⲕ',
  46066. 'â²–' => 'â²—',
  46067. 'Ⲙ' => 'ⲙ',
  46068. 'Ⲛ' => 'ⲛ',
  46069. 'Ⲝ' => '�',
  46070. 'Ⲟ' => 'ⲟ',
  46071. 'Ⲡ' => 'ⲡ',
  46072. 'â²¢' => 'â²£',
  46073. 'Ⲥ' => 'ⲥ',
  46074. 'Ⲧ' => 'ⲧ',
  46075. 'Ⲩ' => 'ⲩ',
  46076. 'Ⲫ' => 'ⲫ',
  46077. 'Ⲭ' => 'ⲭ',
  46078. 'Ⲯ' => 'ⲯ',
  46079. 'â²°' => 'â²±',
  46080. 'â²²' => 'â²³',
  46081. 'â²´' => 'â²µ',
  46082. 'Ⲷ' => 'ⲷ',
  46083. 'Ⲹ' => 'ⲹ',
  46084. 'Ⲻ' => 'ⲻ',
  46085. 'â²¼' => 'â²½',
  46086. 'Ⲿ' => 'ⲿ',
  46087. 'Ⳁ' => '�',
  46088. 'Ⳃ' => 'ⳃ',
  46089. 'Ⳅ' => 'ⳅ',
  46090. 'Ⳇ' => 'ⳇ',
  46091. 'Ⳉ' => 'ⳉ',
  46092. 'Ⳋ' => 'ⳋ',
  46093. 'Ⳍ' => '�',
  46094. 'Ⳏ' => '�',
  46095. '�' => 'ⳑ',
  46096. 'Ⳓ' => 'ⳓ',
  46097. 'Ⳕ' => 'ⳕ',
  46098. 'â³–' => 'â³—',
  46099. 'Ⳙ' => 'ⳙ',
  46100. 'Ⳛ' => 'ⳛ',
  46101. 'Ⳝ' => '�',
  46102. 'Ⳟ' => 'ⳟ',
  46103. 'Ⳡ' => 'ⳡ',
  46104. 'â³¢' => 'â³£',
  46105. 'Ⳬ' => 'ⳬ',
  46106. 'â³­' => 'â³®',
  46107. 'â³²' => 'â³³',
  46108. 'Ꙁ' => '�',
  46109. 'Ꙃ' => 'ꙃ',
  46110. 'Ꙅ' => 'ꙅ',
  46111. 'Ꙇ' => 'ꙇ',
  46112. 'Ꙉ' => 'ꙉ',
  46113. 'Ꙋ' => 'ꙋ',
  46114. 'Ꙍ' => '�',
  46115. 'Ꙏ' => '�',
  46116. '�' => 'ꙑ',
  46117. 'Ꙓ' => 'ꙓ',
  46118. 'Ꙕ' => 'ꙕ',
  46119. 'ê™–' => 'ê™—',
  46120. 'Ꙙ' => 'ꙙ',
  46121. 'Ꙛ' => 'ꙛ',
  46122. 'Ꙝ' => '�',
  46123. 'Ꙟ' => 'ꙟ',
  46124. 'Ꙡ' => 'ꙡ',
  46125. 'Ꙣ' => 'ꙣ',
  46126. 'Ꙥ' => 'ꙥ',
  46127. 'Ꙧ' => 'ꙧ',
  46128. 'Ꙩ' => 'ꙩ',
  46129. 'Ꙫ' => 'ꙫ',
  46130. 'Ꙭ' => 'ꙭ',
  46131. 'Ꚁ' => '�',
  46132. 'Ꚃ' => 'ꚃ',
  46133. 'êš„' => 'êš…',
  46134. 'Ꚇ' => 'ꚇ',
  46135. 'Ꚉ' => 'ꚉ',
  46136. 'Ꚋ' => 'ꚋ',
  46137. 'Ꚍ' => '�',
  46138. 'Ꚏ' => '�',
  46139. '�' => 'ꚑ',
  46140. 'êš’' => 'êš“',
  46141. 'êš”' => 'êš•',
  46142. 'êš–' => 'êš—',
  46143. 'Ꚙ' => 'ꚙ',
  46144. 'êšš' => 'êš›',
  46145. 'Ꜣ' => 'ꜣ',
  46146. 'Ꜥ' => 'ꜥ',
  46147. 'Ꜧ' => 'ꜧ',
  46148. 'Ꜩ' => 'ꜩ',
  46149. 'Ꜫ' => 'ꜫ',
  46150. 'Ꜭ' => 'ꜭ',
  46151. 'Ꜯ' => 'ꜯ',
  46152. 'Ꜳ' => 'ꜳ',
  46153. 'Ꜵ' => 'ꜵ',
  46154. 'Ꜷ' => 'ꜷ',
  46155. 'Ꜹ' => 'ꜹ',
  46156. 'Ꜻ' => 'ꜻ',
  46157. 'Ꜽ' => 'ꜽ',
  46158. 'Ꜿ' => 'ꜿ',
  46159. '�' => '�',
  46160. '�' => '�',
  46161. '�' => '�',
  46162. '�' => '�',
  46163. '�' => '�',
  46164. '�' => '�',
  46165. '�' => '�',
  46166. '�' => '�',
  46167. '�' => '�',
  46168. '�' => '�',
  46169. '�' => '�',
  46170. '�' => '�',
  46171. '�' => '�',
  46172. '�' => '�',
  46173. '�' => '�',
  46174. '�' => '�',
  46175. '�' => '�',
  46176. '�' => '�',
  46177. '�' => '�',
  46178. '�' => '�',
  46179. '�' => '�',
  46180. '�' => '�',
  46181. '�' => '�',
  46182. '�' => '�',
  46183. '�' => '�',
  46184. '�' => '�',
  46185. '�' => 'ᵹ',
  46186. '�' => '�',
  46187. 'Ꞁ' => '�',
  46188. 'Ꞃ' => 'ꞃ',
  46189. 'êž„' => 'êž…',
  46190. 'Ꞇ' => 'ꞇ',
  46191. 'Ꞌ' => 'ꞌ',
  46192. '�' => 'ɥ',
  46193. '�' => 'ꞑ',
  46194. 'êž’' => 'êž“',
  46195. 'êž–' => 'êž—',
  46196. 'Ꞙ' => 'ꞙ',
  46197. 'êžš' => 'êž›',
  46198. 'Ꞝ' => '�',
  46199. 'Ꞟ' => 'ꞟ',
  46200. 'êž ' => 'êž¡',
  46201. 'Ꞣ' => 'ꞣ',
  46202. 'Ꞥ' => 'ꞥ',
  46203. 'Ꞧ' => 'ꞧ',
  46204. 'Ꞩ' => 'ꞩ',
  46205. 'Ɦ' => 'ɦ',
  46206. 'Ɜ' => 'ɜ',
  46207. 'Ɡ' => 'ɡ',
  46208. 'Ɬ' => 'ɬ',
  46209. 'Ɪ' => 'ɪ',
  46210. 'êž°' => 'Êž',
  46211. 'Ʇ' => 'ʇ',
  46212. 'Ʝ' => '�',
  46213. 'êž³' => 'ê­“',
  46214. 'êž´' => 'êžµ',
  46215. 'Ꞷ' => 'ꞷ',
  46216. 'Ꞹ' => 'ꞹ',
  46217. 'Ꞻ' => 'ꞻ',
  46218. 'êž¼' => 'êž½',
  46219. 'êž¾' => 'êž¿',
  46220. 'Ꟃ' => 'ꟃ',
  46221. 'Ꞔ' => 'ꞔ',
  46222. 'Ʂ' => 'ʂ',
  46223. 'Ᶎ' => 'ᶎ',
  46224. 'Ꟈ' => 'ꟈ',
  46225. 'Ꟊ' => 'ꟊ',
  46226. 'Ꟶ' => 'ꟶ',
  46227. 'A' => '�',
  46228. 'B' => 'b',
  46229. 'C' => 'c',
  46230. 'D' => 'd',
  46231. 'ï¼¥' => 'ï½…',
  46232. 'F' => 'f',
  46233. 'G' => 'g',
  46234. 'H' => 'h',
  46235. 'I' => 'i',
  46236. 'J' => 'j',
  46237. 'K' => 'k',
  46238. 'L' => 'l',
  46239. 'M' => '�',
  46240. 'N' => 'n',
  46241. 'O' => '�',
  46242. 'P' => '�',
  46243. 'Q' => 'q',
  46244. 'ï¼²' => 'ï½’',
  46245. 'S' => 's',
  46246. 'ï¼´' => 'ï½”',
  46247. 'U' => 'u',
  46248. 'V' => 'v',
  46249. 'ï¼·' => 'ï½—',
  46250. 'X' => 'x',
  46251. 'ï¼¹' => 'ï½™',
  46252. 'Z' => 'z',
  46253. '�' => '�',
  46254. '�' => '�',
  46255. '�' => '�',
  46256. '�' => '�',
  46257. '�' => '�',
  46258. '�' => '�',
  46259. '�' => '�',
  46260. '�' => '�',
  46261. '�' => '�',
  46262. '�' => '�',
  46263. '�' => '�',
  46264. '�' => '�',
  46265. '�' => '�',
  46266. '�' => '�',
  46267. '�' => '�',
  46268. '�' => '�',
  46269. '�' => '�',
  46270. '�' => '�',
  46271. '�' => '�',
  46272. '�' => '�',
  46273. '�' => '�',
  46274. '�' => '�',
  46275. '�' => '�',
  46276. '�' => '�',
  46277. '�' => '�',
  46278. '�' => '�',
  46279. '�' => '�',
  46280. '�' => '�',
  46281. '�' => '�',
  46282. '�' => '�',
  46283. '�' => '�',
  46284. '�' => '�',
  46285. '�' => '�',
  46286. '�' => '�',
  46287. '�' => '�',
  46288. '�' => '�',
  46289. '�' => '�',
  46290. '�' => '�',
  46291. '�' => '�',
  46292. '�' => '�',
  46293. '�' => '�',
  46294. '�' => '�',
  46295. '�' => '�',
  46296. '�' => '�',
  46297. '�' => '�',
  46298. '�' => '�',
  46299. '�' => '�',
  46300. '�' => '�',
  46301. '�' => '�',
  46302. '�' => '�',
  46303. '�' => '�',
  46304. '�' => '�',
  46305. '�' => '�',
  46306. '�' => '�',
  46307. '�' => '�',
  46308. '�' => '�',
  46309. '�' => '�',
  46310. '�' => '�',
  46311. '�' => '�',
  46312. '�' => '�',
  46313. '�' => '�',
  46314. '�' => '�',
  46315. '�' => '�',
  46316. '�' => '�',
  46317. '�' => '�',
  46318. '�' => '�',
  46319. '�' => '�',
  46320. '�' => '�',
  46321. '�' => '�',
  46322. '�' => '�',
  46323. '�' => '�',
  46324. '�' => '�',
  46325. '�' => '�',
  46326. '�' => '�',
  46327. '�' => '�',
  46328. '�' => '�',
  46329. '�' => '�',
  46330. '�' => '�',
  46331. '�' => '�',
  46332. '�' => '�',
  46333. '�' => '�',
  46334. '�' => '�',
  46335. '�' => '�',
  46336. '�' => '�',
  46337. '�' => '�',
  46338. '�' => '�',
  46339. '�' => '�',
  46340. '�' => '�',
  46341. '�' => '�',
  46342. '�' => '�',
  46343. '�' => '�',
  46344. '�' => '�',
  46345. '�' => '�',
  46346. '�' => '�',
  46347. '�' => '�',
  46348. '�' => '�',
  46349. '�' => '�',
  46350. '�' => '�',
  46351. '�' => '�',
  46352. '�' => '�',
  46353. '�' => '�',
  46354. '�' => '�',
  46355. '�' => '�',
  46356. '�' => '�',
  46357. '�' => '�',
  46358. '�' => '�',
  46359. '�' => '�',
  46360. '�' => '�',
  46361. '�' => '�',
  46362. '�' => '�',
  46363. '�' => '�',
  46364. '�' => '�',
  46365. '�' => '�',
  46366. '�' => '�',
  46367. '�' => '�',
  46368. '�' => '�',
  46369. '�' => '�',
  46370. '�' => '�',
  46371. '�' => '�',
  46372. '�' => '�',
  46373. '�' => '�',
  46374. '�' => '�',
  46375. '�' => '�',
  46376. '�' => '�',
  46377. '�' => '�',
  46378. '�' => '�',
  46379. '�' => '�',
  46380. 'ð‘¢ ' => 'ð‘£€',
  46381. '𑢡' => '�',
  46382. '𑢢' => '𑣂',
  46383. '𑢣' => '𑣃',
  46384. '𑢤' => '𑣄',
  46385. 'ð‘¢¥' => 'ð‘£…',
  46386. '𑢦' => '𑣆',
  46387. '𑢧' => '𑣇',
  46388. '𑢨' => '𑣈',
  46389. '𑢩' => '𑣉',
  46390. '𑢪' => '𑣊',
  46391. '𑢫' => '𑣋',
  46392. '𑢬' => '𑣌',
  46393. '𑢭' => '�',
  46394. '𑢮' => '𑣎',
  46395. '𑢯' => '�',
  46396. '𑢰' => '�',
  46397. '𑢱' => '𑣑',
  46398. 'ð‘¢²' => 'ð‘£’',
  46399. '𑢳' => '𑣓',
  46400. 'ð‘¢´' => 'ð‘£”',
  46401. '𑢵' => '𑣕',
  46402. '𑢶' => '𑣖',
  46403. 'ð‘¢·' => 'ð‘£—',
  46404. '𑢸' => '𑣘',
  46405. 'ð‘¢¹' => 'ð‘£™',
  46406. '𑢺' => '𑣚',
  46407. 'ð‘¢»' => 'ð‘£›',
  46408. '𑢼' => '𑣜',
  46409. '𑢽' => '�',
  46410. '𑢾' => '𑣞',
  46411. '𑢿' => '𑣟',
  46412. 'ð–¹€' => 'ð–¹ ',
  46413. '�' => '𖹡',
  46414. '𖹂' => '𖹢',
  46415. '𖹃' => '𖹣',
  46416. '𖹄' => '𖹤',
  46417. 'ð–¹…' => 'ð–¹¥',
  46418. '𖹆' => '𖹦',
  46419. '𖹇' => '𖹧',
  46420. '𖹈' => '𖹨',
  46421. '𖹉' => '𖹩',
  46422. '𖹊' => '𖹪',
  46423. '𖹋' => '𖹫',
  46424. '𖹌' => '𖹬',
  46425. '�' => '𖹭',
  46426. '𖹎' => '𖹮',
  46427. '�' => '𖹯',
  46428. '�' => '𖹰',
  46429. '𖹑' => '𖹱',
  46430. 'ð–¹’' => 'ð–¹²',
  46431. '𖹓' => '𖹳',
  46432. 'ð–¹”' => 'ð–¹´',
  46433. '𖹕' => '𖹵',
  46434. '𖹖' => '𖹶',
  46435. 'ð–¹—' => 'ð–¹·',
  46436. '𖹘' => '𖹸',
  46437. 'ð–¹™' => 'ð–¹¹',
  46438. '𖹚' => '𖹺',
  46439. 'ð–¹›' => 'ð–¹»',
  46440. '𖹜' => '𖹼',
  46441. '�' => '𖹽',
  46442. '𖹞' => '𖹾',
  46443. '𖹟' => '𖹿',
  46444. '𞤀' => '𞤢',
  46445. '�' => '𞤣',
  46446. '𞤂' => '𞤤',
  46447. '𞤃' => '𞤥',
  46448. '𞤄' => '𞤦',
  46449. '𞤅' => '𞤧',
  46450. '𞤆' => '𞤨',
  46451. '𞤇' => '𞤩',
  46452. '𞤈' => '𞤪',
  46453. '𞤉' => '𞤫',
  46454. '𞤊' => '𞤬',
  46455. '𞤋' => '𞤭',
  46456. '𞤌' => '𞤮',
  46457. '�' => '𞤯',
  46458. '𞤎' => '𞤰',
  46459. '�' => '𞤱',
  46460. '�' => '𞤲',
  46461. '𞤑' => '𞤳',
  46462. '𞤒' => '𞤴',
  46463. '𞤓' => '𞤵',
  46464. '𞤔' => '𞤶',
  46465. '𞤕' => '𞤷',
  46466. '𞤖' => '𞤸',
  46467. '𞤗' => '𞤹',
  46468. '𞤘' => '𞤺',
  46469. '𞤙' => '𞤻',
  46470. '𞤚' => '𞤼',
  46471. '𞤛' => '𞤽',
  46472. '𞤜' => '𞤾',
  46473. '�' => '𞤿',
  46474. '𞤞' => '𞥀',
  46475. '𞤟' => '�',
  46476. '𞤠' => '𞥂',
  46477. '𞤡' => '𞥃',
  46478. );
  46479. <?php
  46480. 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';
  46481. <?php
  46482. return array (
  46483. 'a' => 'A',
  46484. 'b' => 'B',
  46485. 'c' => 'C',
  46486. 'd' => 'D',
  46487. 'e' => 'E',
  46488. 'f' => 'F',
  46489. 'g' => 'G',
  46490. 'h' => 'H',
  46491. 'i' => 'I',
  46492. 'j' => 'J',
  46493. 'k' => 'K',
  46494. 'l' => 'L',
  46495. 'm' => 'M',
  46496. 'n' => 'N',
  46497. 'o' => 'O',
  46498. 'p' => 'P',
  46499. 'q' => 'Q',
  46500. 'r' => 'R',
  46501. 's' => 'S',
  46502. 't' => 'T',
  46503. 'u' => 'U',
  46504. 'v' => 'V',
  46505. 'w' => 'W',
  46506. 'x' => 'X',
  46507. 'y' => 'Y',
  46508. 'z' => 'Z',
  46509. 'µ' => 'Μ',
  46510. 'à' => 'À',
  46511. 'á' => '�',
  46512. 'â' => 'Â',
  46513. 'ã' => 'Ã',
  46514. 'ä' => 'Ä',
  46515. 'Ã¥' => 'Ã…',
  46516. 'æ' => 'Æ',
  46517. 'ç' => 'Ç',
  46518. 'è' => 'È',
  46519. 'é' => 'É',
  46520. 'ê' => 'Ê',
  46521. 'ë' => 'Ë',
  46522. 'ì' => 'Ì',
  46523. 'í' => '�',
  46524. 'î' => 'Î',
  46525. 'ï' => '�',
  46526. 'ð' => '�',
  46527. 'ñ' => 'Ñ',
  46528. 'ò' => 'Ò',
  46529. 'ó' => 'Ó',
  46530. 'ô' => 'Ô',
  46531. 'õ' => 'Õ',
  46532. 'ö' => 'Ö',
  46533. 'ø' => 'Ø',
  46534. 'ù' => 'Ù',
  46535. 'ú' => 'Ú',
  46536. 'û' => 'Û',
  46537. 'ü' => 'Ü',
  46538. 'ý' => '�',
  46539. 'þ' => 'Þ',
  46540. 'ÿ' => 'Ÿ',
  46541. '�' => 'Ā',
  46542. 'ă' => 'Ă',
  46543. 'Ä…' => 'Ä„',
  46544. 'ć' => 'Ć',
  46545. 'ĉ' => 'Ĉ',
  46546. 'Ä‹' => 'ÄŠ',
  46547. '�' => 'Č',
  46548. '�' => 'Ď',
  46549. 'đ' => '�',
  46550. 'Ä“' => 'Ä’',
  46551. 'Ä•' => 'Ä”',
  46552. 'Ä—' => 'Ä–',
  46553. 'ę' => 'Ę',
  46554. 'Ä›' => 'Äš',
  46555. '�' => 'Ĝ',
  46556. 'ÄŸ' => 'Äž',
  46557. 'Ä¡' => 'Ä ',
  46558. 'Ä£' => 'Ä¢',
  46559. 'ĥ' => 'Ĥ',
  46560. 'ħ' => 'Ħ',
  46561. 'ĩ' => 'Ĩ',
  46562. 'ī' => 'Ī',
  46563. 'ĭ' => 'Ĭ',
  46564. 'į' => 'Į',
  46565. 'ı' => 'I',
  46566. 'ij' => 'IJ',
  46567. 'ĵ' => 'Ĵ',
  46568. 'ķ' => 'Ķ',
  46569. 'ĺ' => 'Ĺ',
  46570. 'ļ' => 'Ļ',
  46571. 'ľ' => 'Ľ',
  46572. 'Å€' => 'Ä¿',
  46573. 'ł' => '�',
  46574. 'ń' => 'Ń',
  46575. 'ņ' => 'Ņ',
  46576. 'ň' => 'Ň',
  46577. 'Å‹' => 'ÅŠ',
  46578. '�' => 'Ō',
  46579. '�' => 'Ŏ',
  46580. 'ő' => '�',
  46581. 'Å“' => 'Å’',
  46582. 'Å•' => 'Å”',
  46583. 'Å—' => 'Å–',
  46584. 'ř' => 'Ř',
  46585. 'Å›' => 'Åš',
  46586. '�' => 'Ŝ',
  46587. 'ÅŸ' => 'Åž',
  46588. 'Å¡' => 'Å ',
  46589. 'Å£' => 'Å¢',
  46590. 'ť' => 'Ť',
  46591. 'ŧ' => 'Ŧ',
  46592. 'ũ' => 'Ũ',
  46593. 'ū' => 'Ū',
  46594. 'ŭ' => 'Ŭ',
  46595. 'ů' => 'Ů',
  46596. 'ű' => 'Ű',
  46597. 'ų' => 'Ų',
  46598. 'ŵ' => 'Ŵ',
  46599. 'ŷ' => 'Ŷ',
  46600. 'ź' => 'Ź',
  46601. 'ż' => 'Ż',
  46602. 'ž' => 'Ž',
  46603. 'Å¿' => 'S',
  46604. 'ƀ' => 'Ƀ',
  46605. 'ƃ' => 'Ƃ',
  46606. 'Æ…' => 'Æ„',
  46607. 'ƈ' => 'Ƈ',
  46608. 'ƌ' => 'Ƌ',
  46609. 'Æ’' => 'Æ‘',
  46610. 'ƕ' => 'Ƕ',
  46611. 'ƙ' => 'Ƙ',
  46612. 'ƚ' => 'Ƚ',
  46613. 'Æž' => 'È ',
  46614. 'Æ¡' => 'Æ ',
  46615. 'Æ£' => 'Æ¢',
  46616. 'ƥ' => 'Ƥ',
  46617. 'ƨ' => 'Ƨ',
  46618. 'ƭ' => 'Ƭ',
  46619. 'ư' => 'Ư',
  46620. 'ƴ' => 'Ƴ',
  46621. 'ƶ' => 'Ƶ',
  46622. 'ƹ' => 'Ƹ',
  46623. 'ƽ' => 'Ƽ',
  46624. 'Æ¿' => 'Ç·',
  46625. 'Ç…' => 'Ç„',
  46626. 'dž' => 'DŽ',
  46627. 'Lj' => 'LJ',
  46628. 'lj' => 'LJ',
  46629. 'Ç‹' => 'ÇŠ',
  46630. 'nj' => 'NJ',
  46631. 'ǎ' => '�',
  46632. '�' => '�',
  46633. 'Ç’' => 'Ç‘',
  46634. 'Ç”' => 'Ç“',
  46635. 'Ç–' => 'Ç•',
  46636. 'ǘ' => 'Ǘ',
  46637. 'Çš' => 'Ç™',
  46638. 'ǜ' => 'Ǜ',
  46639. '�' => 'Ǝ',
  46640. 'ÇŸ' => 'Çž',
  46641. 'Ç¡' => 'Ç ',
  46642. 'Ç£' => 'Ç¢',
  46643. 'ǥ' => 'Ǥ',
  46644. 'ǧ' => 'Ǧ',
  46645. 'ǩ' => 'Ǩ',
  46646. 'ǫ' => 'Ǫ',
  46647. 'ǭ' => 'Ǭ',
  46648. 'ǯ' => 'Ǯ',
  46649. 'Dz' => 'DZ',
  46650. 'dz' => 'DZ',
  46651. 'ǵ' => 'Ǵ',
  46652. 'ǹ' => 'Ǹ',
  46653. 'ǻ' => 'Ǻ',
  46654. 'ǽ' => 'Ǽ',
  46655. 'ǿ' => 'Ǿ',
  46656. '�' => 'Ȁ',
  46657. 'ȃ' => 'Ȃ',
  46658. 'È…' => 'È„',
  46659. 'ȇ' => 'Ȇ',
  46660. 'ȉ' => 'Ȉ',
  46661. 'È‹' => 'ÈŠ',
  46662. '�' => 'Ȍ',
  46663. '�' => 'Ȏ',
  46664. 'ȑ' => '�',
  46665. 'È“' => 'È’',
  46666. 'È•' => 'È”',
  46667. 'È—' => 'È–',
  46668. 'ș' => 'Ș',
  46669. 'È›' => 'Èš',
  46670. '�' => 'Ȝ',
  46671. 'ÈŸ' => 'Èž',
  46672. 'È£' => 'È¢',
  46673. 'ȥ' => 'Ȥ',
  46674. 'ȧ' => 'Ȧ',
  46675. 'ȩ' => 'Ȩ',
  46676. 'ȫ' => 'Ȫ',
  46677. 'ȭ' => 'Ȭ',
  46678. 'ȯ' => 'Ȯ',
  46679. 'ȱ' => 'Ȱ',
  46680. 'ȳ' => 'Ȳ',
  46681. 'ȼ' => 'Ȼ',
  46682. 'È¿' => 'â±¾',
  46683. 'ɀ' => 'Ɀ',
  46684. 'ɂ' => '�',
  46685. 'ɇ' => 'Ɇ',
  46686. 'ɉ' => 'Ɉ',
  46687. 'É‹' => 'ÉŠ',
  46688. '�' => 'Ɍ',
  46689. '�' => 'Ɏ',
  46690. '�' => 'Ɐ',
  46691. 'É‘' => 'â±­',
  46692. 'É’' => 'â±°',
  46693. 'ɓ' => '�',
  46694. 'ɔ' => 'Ɔ',
  46695. 'ɖ' => 'Ɖ',
  46696. 'É—' => 'ÆŠ',
  46697. 'ə' => '�',
  46698. 'ɛ' => '�',
  46699. 'ɜ' => 'Ɜ',
  46700. 'É ' => 'Æ“',
  46701. 'ɡ' => 'Ɡ',
  46702. 'É£' => 'Æ”',
  46703. 'ɥ' => '�',
  46704. 'ɦ' => 'Ɦ',
  46705. 'ɨ' => 'Ɨ',
  46706. 'É©' => 'Æ–',
  46707. 'ɪ' => 'Ɪ',
  46708. 'É«' => 'â±¢',
  46709. 'ɬ' => 'Ɬ',
  46710. 'ɯ' => 'Ɯ',
  46711. 'ɱ' => 'Ɱ',
  46712. 'ɲ' => '�',
  46713. 'ɵ' => 'Ɵ',
  46714. 'ɽ' => 'Ɽ',
  46715. 'ʀ' => 'Ʀ',
  46716. 'ʂ' => 'Ʂ',
  46717. 'ʃ' => 'Ʃ',
  46718. 'ʇ' => 'Ʇ',
  46719. 'ʈ' => 'Ʈ',
  46720. 'ʉ' => 'Ʉ',
  46721. 'ʊ' => 'Ʊ',
  46722. 'ʋ' => 'Ʋ',
  46723. 'ʌ' => 'Ʌ',
  46724. 'Ê’' => 'Æ·',
  46725. '�' => 'Ʝ',
  46726. 'Êž' => 'êž°',
  46727. 'ͅ' => 'Ι',
  46728. 'ͱ' => 'Ͱ',
  46729. 'ͳ' => 'Ͳ',
  46730. 'ͷ' => 'Ͷ',
  46731. 'ͻ' => 'Ͻ',
  46732. 'ͼ' => 'Ͼ',
  46733. 'ͽ' => 'Ͽ',
  46734. 'ά' => 'Ά',
  46735. 'έ' => 'Έ',
  46736. 'ή' => 'Ή',
  46737. 'ί' => 'Ί',
  46738. 'α' => 'Α',
  46739. 'β' => 'Β',
  46740. 'γ' => 'Γ',
  46741. 'δ' => 'Δ',
  46742. 'ε' => 'Ε',
  46743. 'ζ' => 'Ζ',
  46744. 'η' => 'Η',
  46745. 'θ' => 'Θ',
  46746. 'ι' => 'Ι',
  46747. 'κ' => 'Κ',
  46748. 'λ' => 'Λ',
  46749. 'μ' => 'Μ',
  46750. 'ν' => '�',
  46751. 'ξ' => 'Ξ',
  46752. 'ο' => 'Ο',
  46753. 'π' => 'Π',
  46754. '�' => 'Ρ',
  46755. 'ς' => 'Σ',
  46756. 'σ' => 'Σ',
  46757. 'τ' => 'Τ',
  46758. 'Ï…' => 'Î¥',
  46759. 'φ' => 'Φ',
  46760. 'χ' => 'Χ',
  46761. 'ψ' => 'Ψ',
  46762. 'ω' => 'Ω',
  46763. 'ϊ' => 'Ϊ',
  46764. 'ϋ' => 'Ϋ',
  46765. 'ό' => 'Ό',
  46766. '�' => 'Ύ',
  46767. 'ώ' => '�',
  46768. '�' => 'Β',
  46769. 'ϑ' => 'Θ',
  46770. 'ϕ' => 'Φ',
  46771. 'ϖ' => 'Π',
  46772. 'ϗ' => '�',
  46773. 'ϙ' => 'Ϙ',
  46774. 'Ï›' => 'Ïš',
  46775. '�' => 'Ϝ',
  46776. 'ÏŸ' => 'Ïž',
  46777. 'Ï¡' => 'Ï ',
  46778. 'Ï£' => 'Ï¢',
  46779. 'ϥ' => 'Ϥ',
  46780. 'ϧ' => 'Ϧ',
  46781. 'ϩ' => 'Ϩ',
  46782. 'ϫ' => 'Ϫ',
  46783. 'ϭ' => 'Ϭ',
  46784. 'ϯ' => 'Ϯ',
  46785. 'ϰ' => 'Κ',
  46786. 'ϱ' => 'Ρ',
  46787. 'ϲ' => 'Ϲ',
  46788. 'ϳ' => 'Ϳ',
  46789. 'ϵ' => 'Ε',
  46790. 'ϸ' => 'Ϸ',
  46791. 'ϻ' => 'Ϻ',
  46792. 'а' => '�',
  46793. 'б' => 'Б',
  46794. 'в' => 'В',
  46795. 'г' => 'Г',
  46796. 'д' => 'Д',
  46797. 'е' => 'Е',
  46798. 'ж' => 'Ж',
  46799. 'з' => 'З',
  46800. 'и' => 'И',
  46801. 'й' => 'Й',
  46802. 'к' => 'К',
  46803. 'л' => 'Л',
  46804. 'м' => 'М',
  46805. 'н' => '�',
  46806. 'о' => 'О',
  46807. 'п' => 'П',
  46808. 'р' => 'Р',
  46809. '�' => 'С',
  46810. 'т' => 'Т',
  46811. 'у' => 'У',
  46812. 'ф' => 'Ф',
  46813. 'Ñ…' => 'Ð¥',
  46814. 'ц' => 'Ц',
  46815. 'ч' => 'Ч',
  46816. 'ш' => 'Ш',
  46817. 'щ' => 'Щ',
  46818. 'ъ' => 'Ъ',
  46819. 'ы' => 'Ы',
  46820. 'ь' => 'Ь',
  46821. '�' => 'Э',
  46822. 'ю' => 'Ю',
  46823. '�' => 'Я',
  46824. '�' => 'Ѐ',
  46825. 'ё' => '�',
  46826. 'ђ' => 'Ђ',
  46827. 'ѓ' => 'Ѓ',
  46828. 'є' => 'Є',
  46829. 'Ñ•' => 'Ð…',
  46830. 'і' => 'І',
  46831. 'ї' => 'Ї',
  46832. 'ј' => 'Ј',
  46833. 'љ' => 'Љ',
  46834. 'њ' => 'Њ',
  46835. 'ћ' => 'Ћ',
  46836. 'ќ' => 'Ќ',
  46837. '�' => '�',
  46838. 'Ñž' => 'ÐŽ',
  46839. 'џ' => '�',
  46840. 'Ñ¡' => 'Ñ ',
  46841. 'Ñ£' => 'Ñ¢',
  46842. 'ѥ' => 'Ѥ',
  46843. 'ѧ' => 'Ѧ',
  46844. 'ѩ' => 'Ѩ',
  46845. 'ѫ' => 'Ѫ',
  46846. 'ѭ' => 'Ѭ',
  46847. 'ѯ' => 'Ѯ',
  46848. 'ѱ' => 'Ѱ',
  46849. 'ѳ' => 'Ѳ',
  46850. 'ѵ' => 'Ѵ',
  46851. 'ѷ' => 'Ѷ',
  46852. 'ѹ' => 'Ѹ',
  46853. 'ѻ' => 'Ѻ',
  46854. 'ѽ' => 'Ѽ',
  46855. 'ѿ' => 'Ѿ',
  46856. 'Ò�' => 'Ò€',
  46857. 'Ò‹' => 'ÒŠ',
  46858. '�' => 'Ҍ',
  46859. 'Ò�' => 'ÒŽ',
  46860. 'Ò‘' => 'Ò�',
  46861. 'Ò“' => 'Ò’',
  46862. 'Ò•' => 'Ò”',
  46863. 'Ò—' => 'Ò–',
  46864. 'Ò™' => 'Ò˜',
  46865. 'Ò›' => 'Òš',
  46866. '�' => 'Ҝ',
  46867. 'ÒŸ' => 'Òž',
  46868. 'Ò¡' => 'Ò ',
  46869. 'Ò£' => 'Ò¢',
  46870. 'Ò¥' => 'Ò¤',
  46871. 'Ò§' => 'Ò¦',
  46872. 'Ò©' => 'Ò¨',
  46873. 'Ò«' => 'Òª',
  46874. 'Ò­' => 'Ò¬',
  46875. 'Ò¯' => 'Ò®',
  46876. 'Ò±' => 'Ò°',
  46877. 'Ò³' => 'Ò²',
  46878. 'Òµ' => 'Ò´',
  46879. 'Ò·' => 'Ò¶',
  46880. 'Ò¹' => 'Ò¸',
  46881. 'Ò»' => 'Òº',
  46882. 'Ò½' => 'Ò¼',
  46883. 'Ò¿' => 'Ò¾',
  46884. 'Ó‚' => 'Ó�',
  46885. 'Ó„' => 'Óƒ',
  46886. 'Ó†' => 'Ó…',
  46887. 'Óˆ' => 'Ó‡',
  46888. 'ÓŠ' => 'Ó‰',
  46889. 'ӌ' => 'Ӌ',
  46890. 'ÓŽ' => 'Ó�',
  46891. 'Ó�' => 'Ó€',
  46892. 'Ó‘' => 'Ó�',
  46893. 'Ó“' => 'Ó’',
  46894. 'Ó•' => 'Ó”',
  46895. 'Ó—' => 'Ó–',
  46896. 'Ó™' => 'Ó˜',
  46897. 'Ó›' => 'Óš',
  46898. '�' => 'Ӝ',
  46899. 'ÓŸ' => 'Óž',
  46900. 'Ó¡' => 'Ó ',
  46901. 'Ó£' => 'Ó¢',
  46902. 'Ó¥' => 'Ó¤',
  46903. 'Ó§' => 'Ó¦',
  46904. 'Ó©' => 'Ó¨',
  46905. 'Ó«' => 'Óª',
  46906. 'Ó­' => 'Ó¬',
  46907. 'Ó¯' => 'Ó®',
  46908. 'Ó±' => 'Ó°',
  46909. 'Ó³' => 'Ó²',
  46910. 'Óµ' => 'Ó´',
  46911. 'Ó·' => 'Ó¶',
  46912. 'Ó¹' => 'Ó¸',
  46913. 'Ó»' => 'Óº',
  46914. 'Ó½' => 'Ó¼',
  46915. 'Ó¿' => 'Ó¾',
  46916. 'Ô�' => 'Ô€',
  46917. 'Ôƒ' => 'Ô‚',
  46918. 'Ô…' => 'Ô„',
  46919. 'Ô‡' => 'Ô†',
  46920. 'Ô‰' => 'Ôˆ',
  46921. 'Ô‹' => 'ÔŠ',
  46922. '�' => 'Ԍ',
  46923. 'Ô�' => 'ÔŽ',
  46924. 'Ô‘' => 'Ô�',
  46925. 'Ô“' => 'Ô’',
  46926. 'Ô•' => 'Ô”',
  46927. 'Ô—' => 'Ô–',
  46928. 'Ô™' => 'Ô˜',
  46929. 'Ô›' => 'Ôš',
  46930. '�' => 'Ԝ',
  46931. 'ÔŸ' => 'Ôž',
  46932. 'Ô¡' => 'Ô ',
  46933. 'Ô£' => 'Ô¢',
  46934. 'Ô¥' => 'Ô¤',
  46935. 'Ô§' => 'Ô¦',
  46936. 'Ô©' => 'Ô¨',
  46937. 'Ô«' => 'Ôª',
  46938. 'Ô­' => 'Ô¬',
  46939. 'Ô¯' => 'Ô®',
  46940. 'Õ¡' => 'Ô±',
  46941. 'Õ¢' => 'Ô²',
  46942. 'Õ£' => 'Ô³',
  46943. 'Õ¤' => 'Ô´',
  46944. 'Õ¥' => 'Ôµ',
  46945. 'Õ¦' => 'Ô¶',
  46946. 'Õ§' => 'Ô·',
  46947. 'Õ¨' => 'Ô¸',
  46948. 'Õ©' => 'Ô¹',
  46949. 'Õª' => 'Ôº',
  46950. 'Õ«' => 'Ô»',
  46951. 'Õ¬' => 'Ô¼',
  46952. 'Õ­' => 'Ô½',
  46953. 'Õ®' => 'Ô¾',
  46954. 'Õ¯' => 'Ô¿',
  46955. 'Õ°' => 'Õ€',
  46956. 'Õ±' => 'Õ�',
  46957. 'Õ²' => 'Õ‚',
  46958. 'Õ³' => 'Õƒ',
  46959. 'Õ´' => 'Õ„',
  46960. 'Õµ' => 'Õ…',
  46961. 'Õ¶' => 'Õ†',
  46962. 'Õ·' => 'Õ‡',
  46963. 'Õ¸' => 'Õˆ',
  46964. 'Õ¹' => 'Õ‰',
  46965. 'Õº' => 'ÕŠ',
  46966. 'Õ»' => 'Õ‹',
  46967. 'ռ' => 'Ռ',
  46968. 'Õ½' => 'Õ�',
  46969. 'Õ¾' => 'ÕŽ',
  46970. 'Õ¿' => 'Õ�',
  46971. 'Ö€' => 'Õ�',
  46972. 'Ö�' => 'Õ‘',
  46973. 'Ö‚' => 'Õ’',
  46974. 'Öƒ' => 'Õ“',
  46975. 'Ö„' => 'Õ”',
  46976. 'Ö…' => 'Õ•',
  46977. 'Ö†' => 'Õ–',
  46978. '�' => '�',
  46979. 'ბ' => 'Ბ',
  46980. 'გ' => 'Გ',
  46981. 'დ' => 'Დ',
  46982. 'ე' => 'Ე',
  46983. 'ვ' => 'Ვ',
  46984. 'ზ' => 'Ზ',
  46985. 'თ' => 'Თ',
  46986. 'ი' => 'Ი',
  46987. 'კ' => 'Კ',
  46988. 'ლ' => 'Ლ',
  46989. 'მ' => 'Მ',
  46990. 'ნ' => 'Ნ',
  46991. '�' => '�',
  46992. 'პ' => 'Პ',
  46993. 'ჟ' => 'Ჟ',
  46994. 'რ' => 'Რ',
  46995. 'ს' => 'Ს',
  46996. 'ტ' => 'Ტ',
  46997. 'უ' => 'Უ',
  46998. 'ფ' => 'Ფ',
  46999. 'ქ' => 'Ქ',
  47000. 'ღ' => 'Ღ',
  47001. 'ყ' => 'Ყ',
  47002. 'შ' => 'Შ',
  47003. 'ჩ' => 'Ჩ',
  47004. 'ც' => 'Ც',
  47005. 'ძ' => 'Ძ',
  47006. 'წ' => 'Წ',
  47007. 'ჭ' => 'Ჭ',
  47008. 'ხ' => 'Ხ',
  47009. 'ჯ' => 'Ჯ',
  47010. 'ჰ' => 'Ჰ',
  47011. 'ჱ' => 'Ჱ',
  47012. 'ჲ' => 'Ჲ',
  47013. 'ჳ' => 'Ჳ',
  47014. 'ჴ' => 'Ჴ',
  47015. 'ჵ' => 'Ჵ',
  47016. 'ჶ' => 'Ჶ',
  47017. 'ჷ' => 'Ჷ',
  47018. 'ჸ' => 'Ჸ',
  47019. 'ჹ' => 'Ჹ',
  47020. 'ჺ' => 'Ჺ',
  47021. 'ჽ' => 'Ჽ',
  47022. 'ჾ' => 'Ჾ',
  47023. 'ჿ' => 'Ჿ',
  47024. '�' => '�',
  47025. '�' => '�',
  47026. '�' => '�',
  47027. '�' => '�',
  47028. '�' => '�',
  47029. '�' => '�',
  47030. 'á²€' => 'Ð’',
  47031. '�' => 'Д',
  47032. 'ᲂ' => 'О',
  47033. 'ᲃ' => 'С',
  47034. 'ᲄ' => 'Т',
  47035. 'ᲅ' => 'Т',
  47036. 'ᲆ' => 'Ъ',
  47037. 'ᲇ' => 'Ѣ',
  47038. 'ᲈ' => 'Ꙋ',
  47039. 'ᵹ' => '�',
  47040. 'áµ½' => 'â±£',
  47041. 'ᶎ' => 'Ᶎ',
  47042. '�' => 'Ḁ',
  47043. 'ḃ' => 'Ḃ',
  47044. 'ḅ' => 'Ḅ',
  47045. 'ḇ' => 'Ḇ',
  47046. 'ḉ' => 'Ḉ',
  47047. 'ḋ' => 'Ḋ',
  47048. '�' => 'Ḍ',
  47049. '�' => 'Ḏ',
  47050. 'ḑ' => '�',
  47051. 'ḓ' => 'Ḓ',
  47052. 'ḕ' => 'Ḕ',
  47053. 'ḗ' => 'Ḗ',
  47054. 'ḙ' => 'Ḙ',
  47055. 'ḛ' => 'Ḛ',
  47056. '�' => 'Ḝ',
  47057. 'ḟ' => 'Ḟ',
  47058. 'ḡ' => 'Ḡ',
  47059. 'ḣ' => 'Ḣ',
  47060. 'ḥ' => 'Ḥ',
  47061. 'ḧ' => 'Ḧ',
  47062. 'ḩ' => 'Ḩ',
  47063. 'ḫ' => 'Ḫ',
  47064. 'ḭ' => 'Ḭ',
  47065. 'ḯ' => 'Ḯ',
  47066. 'ḱ' => 'Ḱ',
  47067. 'ḳ' => 'Ḳ',
  47068. 'ḵ' => 'Ḵ',
  47069. 'ḷ' => 'Ḷ',
  47070. 'ḹ' => 'Ḹ',
  47071. 'ḻ' => 'Ḻ',
  47072. 'ḽ' => 'Ḽ',
  47073. 'ḿ' => 'Ḿ',
  47074. '�' => 'Ṁ',
  47075. 'ṃ' => 'Ṃ',
  47076. 'ṅ' => 'Ṅ',
  47077. 'ṇ' => 'Ṇ',
  47078. 'ṉ' => 'Ṉ',
  47079. 'ṋ' => 'Ṋ',
  47080. '�' => 'Ṍ',
  47081. '�' => 'Ṏ',
  47082. 'ṑ' => '�',
  47083. 'ṓ' => 'Ṓ',
  47084. 'ṕ' => 'Ṕ',
  47085. 'á¹—' => 'á¹–',
  47086. 'ṙ' => 'Ṙ',
  47087. 'ṛ' => 'Ṛ',
  47088. '�' => 'Ṝ',
  47089. 'ṟ' => 'Ṟ',
  47090. 'ṡ' => 'Ṡ',
  47091. 'á¹£' => 'á¹¢',
  47092. 'ṥ' => 'Ṥ',
  47093. 'ṧ' => 'Ṧ',
  47094. 'ṩ' => 'Ṩ',
  47095. 'ṫ' => 'Ṫ',
  47096. 'ṭ' => 'Ṭ',
  47097. 'ṯ' => 'Ṯ',
  47098. 'á¹±' => 'á¹°',
  47099. 'á¹³' => 'á¹²',
  47100. 'á¹µ' => 'á¹´',
  47101. 'ṷ' => 'Ṷ',
  47102. 'ṹ' => 'Ṹ',
  47103. 'ṻ' => 'Ṻ',
  47104. 'á¹½' => 'á¹¼',
  47105. 'ṿ' => 'Ṿ',
  47106. '�' => 'Ẁ',
  47107. 'ẃ' => 'Ẃ',
  47108. 'ẅ' => 'Ẅ',
  47109. 'ẇ' => 'Ẇ',
  47110. 'ẉ' => 'Ẉ',
  47111. 'ẋ' => 'Ẋ',
  47112. '�' => 'Ẍ',
  47113. '�' => 'Ẏ',
  47114. 'ẑ' => '�',
  47115. 'ẓ' => 'Ẓ',
  47116. 'ẕ' => 'Ẕ',
  47117. 'ẛ' => 'Ṡ',
  47118. 'ạ' => 'Ạ',
  47119. 'ả' => 'Ả',
  47120. 'ấ' => 'Ấ',
  47121. 'ầ' => 'Ầ',
  47122. 'ẩ' => 'Ẩ',
  47123. 'ẫ' => 'Ẫ',
  47124. 'ậ' => 'Ậ',
  47125. 'ắ' => 'Ắ',
  47126. 'ằ' => 'Ằ',
  47127. 'ẳ' => 'Ẳ',
  47128. 'ẵ' => 'Ẵ',
  47129. 'ặ' => 'Ặ',
  47130. 'ẹ' => 'Ẹ',
  47131. 'ẻ' => 'Ẻ',
  47132. 'ẽ' => 'Ẽ',
  47133. 'ế' => 'Ế',
  47134. '�' => 'Ề',
  47135. 'ể' => 'Ể',
  47136. 'ễ' => 'Ễ',
  47137. 'ệ' => 'Ệ',
  47138. 'ỉ' => 'Ỉ',
  47139. 'ị' => 'Ị',
  47140. '�' => 'Ọ',
  47141. '�' => 'Ỏ',
  47142. 'ố' => '�',
  47143. 'ồ' => 'Ồ',
  47144. 'ổ' => 'Ổ',
  47145. 'á»—' => 'á»–',
  47146. 'ộ' => 'Ộ',
  47147. 'ớ' => 'Ớ',
  47148. '�' => 'Ờ',
  47149. 'ở' => 'Ở',
  47150. 'ỡ' => 'Ỡ',
  47151. 'ợ' => 'Ợ',
  47152. 'ụ' => 'Ụ',
  47153. 'ủ' => 'Ủ',
  47154. 'ứ' => 'Ứ',
  47155. 'ừ' => 'Ừ',
  47156. 'ử' => 'Ử',
  47157. 'ữ' => 'Ữ',
  47158. 'á»±' => 'á»°',
  47159. 'ỳ' => 'Ỳ',
  47160. 'ỵ' => 'Ỵ',
  47161. 'ỷ' => 'Ỷ',
  47162. 'ỹ' => 'Ỹ',
  47163. 'ỻ' => 'Ỻ',
  47164. 'ỽ' => 'Ỽ',
  47165. 'ỿ' => 'Ỿ',
  47166. 'ἀ' => 'Ἀ',
  47167. '�' => 'Ἁ',
  47168. 'ἂ' => 'Ἂ',
  47169. 'ἃ' => 'Ἃ',
  47170. 'ἄ' => 'Ἄ',
  47171. 'ἅ' => '�',
  47172. 'ἆ' => 'Ἆ',
  47173. 'ἇ' => '�',
  47174. '�' => 'Ἐ',
  47175. 'ἑ' => 'Ἑ',
  47176. 'ἒ' => 'Ἒ',
  47177. 'ἓ' => 'Ἓ',
  47178. 'ἔ' => 'Ἔ',
  47179. 'ἕ' => '�',
  47180. 'ἠ' => 'Ἠ',
  47181. 'ἡ' => 'Ἡ',
  47182. 'ἢ' => 'Ἢ',
  47183. 'ἣ' => 'Ἣ',
  47184. 'ἤ' => 'Ἤ',
  47185. 'á¼¥' => 'á¼­',
  47186. 'ἦ' => 'Ἦ',
  47187. 'ἧ' => 'Ἧ',
  47188. 'ἰ' => 'Ἰ',
  47189. 'á¼±' => 'á¼¹',
  47190. 'ἲ' => 'Ἲ',
  47191. 'á¼³' => 'á¼»',
  47192. 'á¼´' => 'á¼¼',
  47193. 'á¼µ' => 'á¼½',
  47194. 'ἶ' => 'Ἶ',
  47195. 'ἷ' => 'Ἷ',
  47196. 'ὀ' => 'Ὀ',
  47197. '�' => 'Ὁ',
  47198. 'ὂ' => 'Ὂ',
  47199. 'ὃ' => 'Ὃ',
  47200. 'ὄ' => 'Ὄ',
  47201. 'ὅ' => '�',
  47202. 'ὑ' => 'Ὑ',
  47203. 'ὓ' => 'Ὓ',
  47204. 'ὕ' => '�',
  47205. 'ὗ' => 'Ὗ',
  47206. 'ὠ' => 'Ὠ',
  47207. 'ὡ' => 'Ὡ',
  47208. 'ὢ' => 'Ὢ',
  47209. 'ὣ' => 'Ὣ',
  47210. 'ὤ' => 'Ὤ',
  47211. 'á½¥' => 'á½­',
  47212. 'ὦ' => 'Ὦ',
  47213. 'ὧ' => 'Ὧ',
  47214. 'ὰ' => 'Ὰ',
  47215. 'á½±' => 'á¾»',
  47216. 'ὲ' => 'Ὲ',
  47217. 'έ' => 'Έ',
  47218. 'á½´' => 'á¿Š',
  47219. 'á½µ' => 'á¿‹',
  47220. 'ὶ' => 'Ὶ',
  47221. 'á½·' => 'á¿›',
  47222. 'ὸ' => 'Ὸ',
  47223. 'ό' => 'Ό',
  47224. 'ὺ' => 'Ὺ',
  47225. 'á½»' => 'á¿«',
  47226. 'ὼ' => 'Ὼ',
  47227. 'á½½' => 'á¿»',
  47228. 'ᾀ' => 'ᾈ',
  47229. '�' => 'ᾉ',
  47230. 'ᾂ' => 'ᾊ',
  47231. 'ᾃ' => 'ᾋ',
  47232. 'ᾄ' => 'ᾌ',
  47233. 'ᾅ' => '�',
  47234. 'ᾆ' => 'ᾎ',
  47235. 'ᾇ' => '�',
  47236. '�' => 'ᾘ',
  47237. 'ᾑ' => 'ᾙ',
  47238. 'ᾒ' => 'ᾚ',
  47239. 'ᾓ' => 'ᾛ',
  47240. 'ᾔ' => 'ᾜ',
  47241. 'ᾕ' => '�',
  47242. 'ᾖ' => 'ᾞ',
  47243. 'ᾗ' => 'ᾟ',
  47244. 'ᾠ' => 'ᾨ',
  47245. 'ᾡ' => 'ᾩ',
  47246. 'ᾢ' => 'ᾪ',
  47247. 'ᾣ' => 'ᾫ',
  47248. 'ᾤ' => 'ᾬ',
  47249. 'á¾¥' => 'á¾­',
  47250. 'ᾦ' => 'ᾮ',
  47251. 'ᾧ' => 'ᾯ',
  47252. 'ᾰ' => 'Ᾰ',
  47253. 'á¾±' => 'á¾¹',
  47254. 'á¾³' => 'á¾¼',
  47255. 'ι' => 'Ι',
  47256. 'ῃ' => 'ῌ',
  47257. '�' => 'Ῐ',
  47258. 'á¿‘' => 'á¿™',
  47259. 'ῠ' => 'Ῠ',
  47260. 'á¿¡' => 'á¿©',
  47261. 'ῥ' => 'Ῥ',
  47262. 'ῳ' => 'ῼ',
  47263. 'ⅎ' => 'Ⅎ',
  47264. 'â…°' => 'â… ',
  47265. 'â…±' => 'â…¡',
  47266. 'â…²' => 'â…¢',
  47267. 'â…³' => 'â…£',
  47268. 'â…´' => 'â…¤',
  47269. 'â…µ' => 'â…¥',
  47270. 'â…¶' => 'â…¦',
  47271. 'â…·' => 'â…§',
  47272. 'â…¸' => 'â…¨',
  47273. 'â…¹' => 'â…©',
  47274. 'â…º' => 'â…ª',
  47275. 'â…»' => 'â…«',
  47276. 'â…¼' => 'â…¬',
  47277. 'â…½' => 'â…­',
  47278. 'â…¾' => 'â…®',
  47279. 'â…¿' => 'â…¯',
  47280. 'ↄ' => 'Ↄ',
  47281. '�' => 'Ⓐ',
  47282. 'â“‘' => 'â’·',
  47283. 'â“’' => 'â’¸',
  47284. 'â““' => 'â’¹',
  47285. 'â“”' => 'â’º',
  47286. 'â“•' => 'â’»',
  47287. 'â“–' => 'â’¼',
  47288. 'â“—' => 'â’½',
  47289. 'ⓘ' => 'Ⓘ',
  47290. 'â“™' => 'â’¿',
  47291. 'â“š' => 'â“€',
  47292. 'ⓛ' => '�',
  47293. 'ⓜ' => 'Ⓜ',
  47294. '�' => 'Ⓝ',
  47295. 'â“ž' => 'â“„',
  47296. 'â“Ÿ' => 'â“…',
  47297. 'ⓠ' => 'Ⓠ',
  47298. 'ⓡ' => 'Ⓡ',
  47299. 'ⓢ' => 'Ⓢ',
  47300. 'ⓣ' => 'Ⓣ',
  47301. 'ⓤ' => 'Ⓤ',
  47302. 'â“¥' => 'â“‹',
  47303. 'ⓦ' => 'Ⓦ',
  47304. 'ⓧ' => '�',
  47305. 'ⓨ' => 'Ⓨ',
  47306. 'ⓩ' => '�',
  47307. 'â°°' => 'â°€',
  47308. 'â°±' => 'â°�',
  47309. 'â°²' => 'â°‚',
  47310. 'â°³' => 'â°ƒ',
  47311. 'â°´' => 'â°„',
  47312. 'â°µ' => 'â°…',
  47313. 'â°¶' => 'â°†',
  47314. 'â°·' => 'â°‡',
  47315. 'â°¸' => 'â°ˆ',
  47316. 'â°¹' => 'â°‰',
  47317. 'â°º' => 'â°Š',
  47318. 'â°»' => 'â°‹',
  47319. 'ⰼ' => 'Ⰼ',
  47320. 'â°½' => 'â°�',
  47321. 'â°¾' => 'â°Ž',
  47322. 'â°¿' => 'â°�',
  47323. 'â±€' => 'â°�',
  47324. '�' => 'Ⱁ',
  47325. 'ⱂ' => 'Ⱂ',
  47326. 'ⱃ' => 'Ⱃ',
  47327. 'ⱄ' => 'Ⱄ',
  47328. 'â±…' => 'â°•',
  47329. 'ⱆ' => 'Ⱆ',
  47330. 'ⱇ' => 'Ⱇ',
  47331. 'ⱈ' => 'Ⱈ',
  47332. 'ⱉ' => 'Ⱉ',
  47333. 'ⱊ' => 'Ⱊ',
  47334. 'ⱋ' => 'Ⱋ',
  47335. 'ⱌ' => 'Ⱌ',
  47336. '�' => '�',
  47337. 'ⱎ' => 'Ⱎ',
  47338. '�' => 'Ⱏ',
  47339. '�' => 'Ⱐ',
  47340. 'ⱑ' => 'Ⱑ',
  47341. 'â±’' => 'â°¢',
  47342. 'ⱓ' => 'Ⱓ',
  47343. 'â±”' => 'â°¤',
  47344. 'ⱕ' => 'Ⱕ',
  47345. 'â±–' => 'â°¦',
  47346. 'â±—' => 'â°§',
  47347. 'ⱘ' => 'Ⱘ',
  47348. 'â±™' => 'â°©',
  47349. 'ⱚ' => 'Ⱚ',
  47350. 'â±›' => 'â°«',
  47351. 'ⱜ' => 'Ⱜ',
  47352. '�' => 'Ⱝ',
  47353. 'ⱞ' => 'Ⱞ',
  47354. 'ⱡ' => 'Ⱡ',
  47355. 'ⱥ' => 'Ⱥ',
  47356. 'ⱦ' => 'Ⱦ',
  47357. 'ⱨ' => 'Ⱨ',
  47358. 'ⱪ' => 'Ⱪ',
  47359. 'ⱬ' => 'Ⱬ',
  47360. 'â±³' => 'â±²',
  47361. 'ⱶ' => 'Ⱶ',
  47362. '�' => 'Ⲁ',
  47363. 'ⲃ' => 'Ⲃ',
  47364. 'ⲅ' => 'Ⲅ',
  47365. 'ⲇ' => 'Ⲇ',
  47366. 'ⲉ' => 'Ⲉ',
  47367. 'ⲋ' => 'Ⲋ',
  47368. '�' => 'Ⲍ',
  47369. '�' => 'Ⲏ',
  47370. 'ⲑ' => '�',
  47371. 'ⲓ' => 'Ⲓ',
  47372. 'ⲕ' => 'Ⲕ',
  47373. 'â²—' => 'â²–',
  47374. 'ⲙ' => 'Ⲙ',
  47375. 'ⲛ' => 'Ⲛ',
  47376. '�' => 'Ⲝ',
  47377. 'ⲟ' => 'Ⲟ',
  47378. 'ⲡ' => 'Ⲡ',
  47379. 'â²£' => 'â²¢',
  47380. 'ⲥ' => 'Ⲥ',
  47381. 'ⲧ' => 'Ⲧ',
  47382. 'ⲩ' => 'Ⲩ',
  47383. 'ⲫ' => 'Ⲫ',
  47384. 'ⲭ' => 'Ⲭ',
  47385. 'ⲯ' => 'Ⲯ',
  47386. 'â²±' => 'â²°',
  47387. 'â²³' => 'â²²',
  47388. 'â²µ' => 'â²´',
  47389. 'ⲷ' => 'Ⲷ',
  47390. 'ⲹ' => 'Ⲹ',
  47391. 'ⲻ' => 'Ⲻ',
  47392. 'â²½' => 'â²¼',
  47393. 'ⲿ' => 'Ⲿ',
  47394. '�' => 'Ⳁ',
  47395. 'ⳃ' => 'Ⳃ',
  47396. 'ⳅ' => 'Ⳅ',
  47397. 'ⳇ' => 'Ⳇ',
  47398. 'ⳉ' => 'Ⳉ',
  47399. 'ⳋ' => 'Ⳋ',
  47400. '�' => 'Ⳍ',
  47401. '�' => 'Ⳏ',
  47402. 'ⳑ' => '�',
  47403. 'ⳓ' => 'Ⳓ',
  47404. 'ⳕ' => 'Ⳕ',
  47405. 'â³—' => 'â³–',
  47406. 'ⳙ' => 'Ⳙ',
  47407. 'ⳛ' => 'Ⳛ',
  47408. '�' => 'Ⳝ',
  47409. 'ⳟ' => 'Ⳟ',
  47410. 'ⳡ' => 'Ⳡ',
  47411. 'â³£' => 'â³¢',
  47412. 'ⳬ' => 'Ⳬ',
  47413. 'â³®' => 'â³­',
  47414. 'â³³' => 'â³²',
  47415. 'â´€' => 'á‚ ',
  47416. 'â´�' => 'á‚¡',
  47417. 'â´‚' => 'á‚¢',
  47418. 'â´ƒ' => 'á‚£',
  47419. 'ⴄ' => 'Ⴄ',
  47420. 'â´…' => 'á‚¥',
  47421. 'ⴆ' => 'Ⴆ',
  47422. 'ⴇ' => 'Ⴇ',
  47423. 'ⴈ' => 'Ⴈ',
  47424. 'â´‰' => 'á‚©',
  47425. 'ⴊ' => 'Ⴊ',
  47426. 'â´‹' => 'á‚«',
  47427. 'ⴌ' => 'Ⴌ',
  47428. 'â´�' => 'á‚­',
  47429. 'â´Ž' => 'á‚®',
  47430. '�' => 'Ⴏ',
  47431. 'â´�' => 'á‚°',
  47432. 'ⴑ' => 'Ⴑ',
  47433. 'ⴒ' => 'Ⴒ',
  47434. 'ⴓ' => 'Ⴓ',
  47435. 'â´”' => 'á‚´',
  47436. 'ⴕ' => 'Ⴕ',
  47437. 'ⴖ' => 'Ⴖ',
  47438. 'â´—' => 'á‚·',
  47439. 'ⴘ' => 'Ⴘ',
  47440. 'ⴙ' => 'Ⴙ',
  47441. 'ⴚ' => 'Ⴚ',
  47442. 'â´›' => 'á‚»',
  47443. 'ⴜ' => 'Ⴜ',
  47444. '�' => 'Ⴝ',
  47445. 'ⴞ' => 'Ⴞ',
  47446. 'â´Ÿ' => 'á‚¿',
  47447. 'ⴠ' => 'Ⴠ',
  47448. 'ⴡ' => '�',
  47449. 'ⴢ' => 'Ⴢ',
  47450. 'ⴣ' => 'Ⴣ',
  47451. 'ⴤ' => 'Ⴤ',
  47452. 'ⴥ' => 'Ⴥ',
  47453. 'ⴧ' => 'Ⴧ',
  47454. 'ⴭ' => '�',
  47455. '�' => 'Ꙁ',
  47456. 'ꙃ' => 'Ꙃ',
  47457. 'ꙅ' => 'Ꙅ',
  47458. 'ꙇ' => 'Ꙇ',
  47459. 'ꙉ' => 'Ꙉ',
  47460. 'ꙋ' => 'Ꙋ',
  47461. '�' => 'Ꙍ',
  47462. '�' => 'Ꙏ',
  47463. 'ꙑ' => '�',
  47464. 'ꙓ' => 'Ꙓ',
  47465. 'ꙕ' => 'Ꙕ',
  47466. 'ê™—' => 'ê™–',
  47467. 'ꙙ' => 'Ꙙ',
  47468. 'ꙛ' => 'Ꙛ',
  47469. '�' => 'Ꙝ',
  47470. 'ꙟ' => 'Ꙟ',
  47471. 'ꙡ' => 'Ꙡ',
  47472. 'ꙣ' => 'Ꙣ',
  47473. 'ꙥ' => 'Ꙥ',
  47474. 'ꙧ' => 'Ꙧ',
  47475. 'ꙩ' => 'Ꙩ',
  47476. 'ꙫ' => 'Ꙫ',
  47477. 'ꙭ' => 'Ꙭ',
  47478. '�' => 'Ꚁ',
  47479. 'ꚃ' => 'Ꚃ',
  47480. 'êš…' => 'êš„',
  47481. 'ꚇ' => 'Ꚇ',
  47482. 'ꚉ' => 'Ꚉ',
  47483. 'ꚋ' => 'Ꚋ',
  47484. '�' => 'Ꚍ',
  47485. '�' => 'Ꚏ',
  47486. 'ꚑ' => '�',
  47487. 'êš“' => 'êš’',
  47488. 'êš•' => 'êš”',
  47489. 'êš—' => 'êš–',
  47490. 'ꚙ' => 'Ꚙ',
  47491. 'êš›' => 'êšš',
  47492. 'ꜣ' => 'Ꜣ',
  47493. 'ꜥ' => 'Ꜥ',
  47494. 'ꜧ' => 'Ꜧ',
  47495. 'ꜩ' => 'Ꜩ',
  47496. 'ꜫ' => 'Ꜫ',
  47497. 'ꜭ' => 'Ꜭ',
  47498. 'ꜯ' => 'Ꜯ',
  47499. 'ꜳ' => 'Ꜳ',
  47500. 'ꜵ' => 'Ꜵ',
  47501. 'ꜷ' => 'Ꜷ',
  47502. 'ꜹ' => 'Ꜹ',
  47503. 'ꜻ' => 'Ꜻ',
  47504. 'ꜽ' => 'Ꜽ',
  47505. 'ꜿ' => 'Ꜿ',
  47506. '�' => '�',
  47507. '�' => '�',
  47508. '�' => '�',
  47509. '�' => '�',
  47510. '�' => '�',
  47511. '�' => '�',
  47512. '�' => '�',
  47513. '�' => '�',
  47514. '�' => '�',
  47515. '�' => '�',
  47516. '�' => '�',
  47517. '�' => '�',
  47518. '�' => '�',
  47519. '�' => '�',
  47520. '�' => '�',
  47521. '�' => '�',
  47522. '�' => '�',
  47523. '�' => '�',
  47524. '�' => '�',
  47525. '�' => '�',
  47526. '�' => '�',
  47527. '�' => '�',
  47528. '�' => '�',
  47529. '�' => '�',
  47530. '�' => '�',
  47531. '�' => '�',
  47532. '�' => '�',
  47533. '�' => 'Ꞁ',
  47534. 'ꞃ' => 'Ꞃ',
  47535. 'êž…' => 'êž„',
  47536. 'ꞇ' => 'Ꞇ',
  47537. 'ꞌ' => 'Ꞌ',
  47538. 'ꞑ' => '�',
  47539. 'êž“' => 'êž’',
  47540. 'ꞔ' => 'Ꞔ',
  47541. 'êž—' => 'êž–',
  47542. 'ꞙ' => 'Ꞙ',
  47543. 'êž›' => 'êžš',
  47544. '�' => 'Ꞝ',
  47545. 'ꞟ' => 'Ꞟ',
  47546. 'êž¡' => 'êž ',
  47547. 'ꞣ' => 'Ꞣ',
  47548. 'ꞥ' => 'Ꞥ',
  47549. 'ꞧ' => 'Ꞧ',
  47550. 'ꞩ' => 'Ꞩ',
  47551. 'êžµ' => 'êž´',
  47552. 'ꞷ' => 'Ꞷ',
  47553. 'ꞹ' => 'Ꞹ',
  47554. 'ꞻ' => 'Ꞻ',
  47555. 'êž½' => 'êž¼',
  47556. 'êž¿' => 'êž¾',
  47557. 'ꟃ' => 'Ꟃ',
  47558. 'ꟈ' => 'Ꟈ',
  47559. 'ꟊ' => 'Ꟊ',
  47560. 'ꟶ' => 'Ꟶ',
  47561. 'ê­“' => 'êž³',
  47562. 'ꭰ' => 'Ꭰ',
  47563. 'ꭱ' => 'Ꭱ',
  47564. 'ꭲ' => 'Ꭲ',
  47565. 'ꭳ' => 'Ꭳ',
  47566. 'ꭴ' => 'Ꭴ',
  47567. 'ꭵ' => 'Ꭵ',
  47568. 'ꭶ' => 'Ꭶ',
  47569. 'ꭷ' => 'Ꭷ',
  47570. 'ꭸ' => 'Ꭸ',
  47571. 'ꭹ' => 'Ꭹ',
  47572. 'ꭺ' => 'Ꭺ',
  47573. 'ꭻ' => 'Ꭻ',
  47574. 'ꭼ' => 'Ꭼ',
  47575. 'ꭽ' => 'Ꭽ',
  47576. 'ꭾ' => 'Ꭾ',
  47577. 'ꭿ' => 'Ꭿ',
  47578. 'ꮀ' => 'Ꮀ',
  47579. '�' => 'Ꮁ',
  47580. 'ꮂ' => 'Ꮂ',
  47581. 'ꮃ' => 'Ꮃ',
  47582. 'ꮄ' => 'Ꮄ',
  47583. 'ꮅ' => 'Ꮅ',
  47584. 'ꮆ' => 'Ꮆ',
  47585. 'ꮇ' => 'Ꮇ',
  47586. 'ꮈ' => 'Ꮈ',
  47587. 'ꮉ' => 'Ꮉ',
  47588. 'ꮊ' => 'Ꮊ',
  47589. 'ꮋ' => 'Ꮋ',
  47590. 'ꮌ' => 'Ꮌ',
  47591. '�' => 'Ꮍ',
  47592. 'ꮎ' => 'Ꮎ',
  47593. '�' => 'Ꮏ',
  47594. '�' => '�',
  47595. 'ꮑ' => '�',
  47596. 'ꮒ' => '�',
  47597. 'ꮓ' => '�',
  47598. 'ꮔ' => '�',
  47599. 'ꮕ' => '�',
  47600. 'ꮖ' => '�',
  47601. 'ꮗ' => '�',
  47602. 'ꮘ' => '�',
  47603. 'ꮙ' => '�',
  47604. 'ꮚ' => '�',
  47605. 'ꮛ' => '�',
  47606. 'ꮜ' => '�',
  47607. '�' => '�',
  47608. 'ꮞ' => '�',
  47609. 'ꮟ' => '�',
  47610. 'ꮠ' => '�',
  47611. 'ꮡ' => '�',
  47612. 'ꮢ' => '�',
  47613. 'ꮣ' => '�',
  47614. 'ꮤ' => '�',
  47615. 'ꮥ' => '�',
  47616. 'ꮦ' => '�',
  47617. 'ꮧ' => '�',
  47618. 'ꮨ' => '�',
  47619. 'ꮩ' => '�',
  47620. 'ꮪ' => '�',
  47621. 'ꮫ' => '�',
  47622. 'ꮬ' => '�',
  47623. 'ꮭ' => '�',
  47624. 'ꮮ' => '�',
  47625. 'ꮯ' => '�',
  47626. 'ꮰ' => '�',
  47627. 'ꮱ' => '�',
  47628. 'ꮲ' => '�',
  47629. 'ꮳ' => '�',
  47630. 'ꮴ' => '�',
  47631. 'ꮵ' => '�',
  47632. 'ꮶ' => '�',
  47633. 'ꮷ' => '�',
  47634. 'ꮸ' => '�',
  47635. 'ꮹ' => '�',
  47636. 'ꮺ' => '�',
  47637. 'ꮻ' => '�',
  47638. 'ꮼ' => '�',
  47639. 'ꮽ' => '�',
  47640. 'ꮾ' => '�',
  47641. 'ꮿ' => '�',
  47642. '�' => 'A',
  47643. 'b' => 'B',
  47644. 'c' => 'C',
  47645. 'd' => 'D',
  47646. 'ï½…' => 'ï¼¥',
  47647. 'f' => 'F',
  47648. 'g' => 'G',
  47649. 'h' => 'H',
  47650. 'i' => 'I',
  47651. 'j' => 'J',
  47652. 'k' => 'K',
  47653. 'l' => 'L',
  47654. '�' => 'M',
  47655. 'n' => 'N',
  47656. '�' => 'O',
  47657. '�' => 'P',
  47658. 'q' => 'Q',
  47659. 'ï½’' => 'ï¼²',
  47660. 's' => 'S',
  47661. 'ï½”' => 'ï¼´',
  47662. 'u' => 'U',
  47663. 'v' => 'V',
  47664. 'ï½—' => 'ï¼·',
  47665. 'x' => 'X',
  47666. 'ï½™' => 'ï¼¹',
  47667. 'z' => 'Z',
  47668. '�' => '�',
  47669. '�' => '�',
  47670. '�' => '�',
  47671. '�' => '�',
  47672. '�' => '�',
  47673. '�' => '�',
  47674. '�' => '�',
  47675. '�' => '�',
  47676. '�' => '�',
  47677. '�' => '�',
  47678. '�' => '�',
  47679. '�' => '�',
  47680. '�' => '�',
  47681. '�' => '�',
  47682. '�' => '�',
  47683. '�' => '�',
  47684. '�' => '�',
  47685. '�' => '�',
  47686. '�' => '�',
  47687. '�' => '�',
  47688. '�' => '�',
  47689. '�' => '�',
  47690. '�' => '�',
  47691. '�' => '�',
  47692. '�' => '�',
  47693. '�' => '�',
  47694. '�' => '�',
  47695. '�' => '�',
  47696. '�' => '�',
  47697. '�' => '�',
  47698. '�' => '�',
  47699. '�' => '�',
  47700. '�' => '�',
  47701. '�' => '�',
  47702. '�' => '�',
  47703. '�' => '�',
  47704. '�' => '�',
  47705. '�' => '�',
  47706. '�' => '�',
  47707. '�' => '�',
  47708. '�' => '�',
  47709. '�' => '�',
  47710. '�' => '�',
  47711. '�' => '�',
  47712. '�' => '�',
  47713. '�' => '�',
  47714. '�' => '�',
  47715. '�' => '�',
  47716. '�' => '�',
  47717. '�' => '�',
  47718. '�' => '�',
  47719. '�' => '�',
  47720. '�' => '�',
  47721. '�' => '�',
  47722. '�' => '�',
  47723. '�' => '�',
  47724. '�' => '�',
  47725. '�' => '�',
  47726. '�' => '�',
  47727. '�' => '�',
  47728. '�' => '�',
  47729. '�' => '�',
  47730. '�' => '�',
  47731. '�' => '�',
  47732. '�' => '�',
  47733. '�' => '�',
  47734. '�' => '�',
  47735. '�' => '�',
  47736. '�' => '�',
  47737. '�' => '�',
  47738. '�' => '�',
  47739. '�' => '�',
  47740. '�' => '�',
  47741. '�' => '�',
  47742. '�' => '�',
  47743. '�' => '�',
  47744. '�' => '�',
  47745. '�' => '�',
  47746. '�' => '�',
  47747. '�' => '�',
  47748. '�' => '�',
  47749. '�' => '�',
  47750. '�' => '�',
  47751. '�' => '�',
  47752. '�' => '�',
  47753. '�' => '�',
  47754. '�' => '�',
  47755. '�' => '�',
  47756. '�' => '�',
  47757. '�' => '�',
  47758. '�' => '�',
  47759. '�' => '�',
  47760. '�' => '�',
  47761. '�' => '�',
  47762. '�' => '�',
  47763. '�' => '�',
  47764. '�' => '�',
  47765. '�' => '�',
  47766. '�' => '�',
  47767. '�' => '�',
  47768. '�' => '�',
  47769. '�' => '�',
  47770. '�' => '�',
  47771. '�' => '�',
  47772. '�' => '�',
  47773. '�' => '�',
  47774. '�' => '�',
  47775. '�' => '�',
  47776. '�' => '�',
  47777. '�' => '�',
  47778. '�' => '�',
  47779. '�' => '�',
  47780. '�' => '�',
  47781. '�' => '�',
  47782. '�' => '�',
  47783. '�' => '�',
  47784. '�' => '�',
  47785. '�' => '�',
  47786. '�' => '�',
  47787. '�' => '�',
  47788. '�' => '�',
  47789. '�' => '�',
  47790. '�' => '�',
  47791. '�' => '�',
  47792. '�' => '�',
  47793. '�' => '�',
  47794. '�' => '�',
  47795. 'ð‘£€' => 'ð‘¢ ',
  47796. '�' => '𑢡',
  47797. '𑣂' => '𑢢',
  47798. '𑣃' => '𑢣',
  47799. '𑣄' => '𑢤',
  47800. 'ð‘£…' => 'ð‘¢¥',
  47801. '𑣆' => '𑢦',
  47802. '𑣇' => '𑢧',
  47803. '𑣈' => '𑢨',
  47804. '𑣉' => '𑢩',
  47805. '𑣊' => '𑢪',
  47806. '𑣋' => '𑢫',
  47807. '𑣌' => '𑢬',
  47808. '�' => '𑢭',
  47809. '𑣎' => '𑢮',
  47810. '�' => '𑢯',
  47811. '�' => '𑢰',
  47812. '𑣑' => '𑢱',
  47813. 'ð‘£’' => 'ð‘¢²',
  47814. '𑣓' => '𑢳',
  47815. 'ð‘£”' => 'ð‘¢´',
  47816. '𑣕' => '𑢵',
  47817. '𑣖' => '𑢶',
  47818. 'ð‘£—' => 'ð‘¢·',
  47819. '𑣘' => '𑢸',
  47820. 'ð‘£™' => 'ð‘¢¹',
  47821. '𑣚' => '𑢺',
  47822. 'ð‘£›' => 'ð‘¢»',
  47823. '𑣜' => '𑢼',
  47824. '�' => '𑢽',
  47825. '𑣞' => '𑢾',
  47826. '𑣟' => '𑢿',
  47827. 'ð–¹ ' => 'ð–¹€',
  47828. '𖹡' => '�',
  47829. '𖹢' => '𖹂',
  47830. '𖹣' => '𖹃',
  47831. '𖹤' => '𖹄',
  47832. 'ð–¹¥' => 'ð–¹…',
  47833. '𖹦' => '𖹆',
  47834. '𖹧' => '𖹇',
  47835. '𖹨' => '𖹈',
  47836. '𖹩' => '𖹉',
  47837. '𖹪' => '𖹊',
  47838. '𖹫' => '𖹋',
  47839. '𖹬' => '𖹌',
  47840. '𖹭' => '�',
  47841. '𖹮' => '𖹎',
  47842. '𖹯' => '�',
  47843. '𖹰' => '�',
  47844. '𖹱' => '𖹑',
  47845. 'ð–¹²' => 'ð–¹’',
  47846. '𖹳' => '𖹓',
  47847. 'ð–¹´' => 'ð–¹”',
  47848. '𖹵' => '𖹕',
  47849. '𖹶' => '𖹖',
  47850. 'ð–¹·' => 'ð–¹—',
  47851. '𖹸' => '𖹘',
  47852. 'ð–¹¹' => 'ð–¹™',
  47853. '𖹺' => '𖹚',
  47854. 'ð–¹»' => 'ð–¹›',
  47855. '𖹼' => '𖹜',
  47856. '𖹽' => '�',
  47857. '𖹾' => '𖹞',
  47858. '𖹿' => '𖹟',
  47859. '𞤢' => '𞤀',
  47860. '𞤣' => '�',
  47861. '𞤤' => '𞤂',
  47862. '𞤥' => '𞤃',
  47863. '𞤦' => '𞤄',
  47864. '𞤧' => '𞤅',
  47865. '𞤨' => '𞤆',
  47866. '𞤩' => '𞤇',
  47867. '𞤪' => '𞤈',
  47868. '𞤫' => '𞤉',
  47869. '𞤬' => '𞤊',
  47870. '𞤭' => '𞤋',
  47871. '𞤮' => '𞤌',
  47872. '𞤯' => '�',
  47873. '𞤰' => '𞤎',
  47874. '𞤱' => '�',
  47875. '𞤲' => '�',
  47876. '𞤳' => '𞤑',
  47877. '𞤴' => '𞤒',
  47878. '𞤵' => '𞤓',
  47879. '𞤶' => '𞤔',
  47880. '𞤷' => '𞤕',
  47881. '𞤸' => '𞤖',
  47882. '𞤹' => '𞤗',
  47883. '𞤺' => '𞤘',
  47884. '𞤻' => '𞤙',
  47885. '𞤼' => '𞤚',
  47886. '𞤽' => '𞤛',
  47887. '𞤾' => '𞤜',
  47888. '𞤿' => '�',
  47889. '𞥀' => '𞤞',
  47890. '�' => '𞤟',
  47891. '𞥂' => '𞤠',
  47892. '𞥃' => '𞤡',
  47893. );
  47894. <?php
  47895. use Symfony\Polyfill\Mbstring as p;
  47896. if (!function_exists('mb_convert_encoding')) {
  47897. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  47898. }
  47899. if (!function_exists('mb_decode_mimeheader')) {
  47900. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  47901. }
  47902. if (!function_exists('mb_encode_mimeheader')) {
  47903. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  47904. }
  47905. if (!function_exists('mb_decode_numericentity')) {
  47906. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  47907. }
  47908. if (!function_exists('mb_encode_numericentity')) {
  47909. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  47910. }
  47911. if (!function_exists('mb_convert_case')) {
  47912. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  47913. }
  47914. if (!function_exists('mb_internal_encoding')) {
  47915. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  47916. }
  47917. if (!function_exists('mb_language')) {
  47918. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  47919. }
  47920. if (!function_exists('mb_list_encodings')) {
  47921. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  47922. }
  47923. if (!function_exists('mb_encoding_aliases')) {
  47924. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  47925. }
  47926. if (!function_exists('mb_check_encoding')) {
  47927. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  47928. }
  47929. if (!function_exists('mb_detect_encoding')) {
  47930. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  47931. }
  47932. if (!function_exists('mb_detect_order')) {
  47933. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  47934. }
  47935. if (!function_exists('mb_parse_str')) {
  47936. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  47937. }
  47938. if (!function_exists('mb_strlen')) {
  47939. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  47940. }
  47941. if (!function_exists('mb_strpos')) {
  47942. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  47943. }
  47944. if (!function_exists('mb_strtolower')) {
  47945. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  47946. }
  47947. if (!function_exists('mb_strtoupper')) {
  47948. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  47949. }
  47950. if (!function_exists('mb_substitute_character')) {
  47951. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  47952. }
  47953. if (!function_exists('mb_substr')) {
  47954. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  47955. }
  47956. if (!function_exists('mb_stripos')) {
  47957. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  47958. }
  47959. if (!function_exists('mb_stristr')) {
  47960. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  47961. }
  47962. if (!function_exists('mb_strrchr')) {
  47963. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  47964. }
  47965. if (!function_exists('mb_strrichr')) {
  47966. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  47967. }
  47968. if (!function_exists('mb_strripos')) {
  47969. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  47970. }
  47971. if (!function_exists('mb_strrpos')) {
  47972. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  47973. }
  47974. if (!function_exists('mb_strstr')) {
  47975. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  47976. }
  47977. if (!function_exists('mb_get_info')) {
  47978. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  47979. }
  47980. if (!function_exists('mb_http_output')) {
  47981. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  47982. }
  47983. if (!function_exists('mb_strwidth')) {
  47984. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  47985. }
  47986. if (!function_exists('mb_substr_count')) {
  47987. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  47988. }
  47989. if (!function_exists('mb_output_handler')) {
  47990. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  47991. }
  47992. if (!function_exists('mb_http_input')) {
  47993. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  47994. }
  47995. if (!function_exists('mb_convert_variables')) {
  47996. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  47997. }
  47998. if (!function_exists('mb_ord')) {
  47999. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  48000. }
  48001. if (!function_exists('mb_chr')) {
  48002. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  48003. }
  48004. if (!function_exists('mb_scrub')) {
  48005. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  48006. }
  48007. if (!function_exists('mb_str_split')) {
  48008. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  48009. }
  48010. if (extension_loaded('mbstring')) {
  48011. return;
  48012. }
  48013. if (!defined('MB_CASE_UPPER')) {
  48014. define('MB_CASE_UPPER', 0);
  48015. }
  48016. if (!defined('MB_CASE_LOWER')) {
  48017. define('MB_CASE_LOWER', 1);
  48018. }
  48019. if (!defined('MB_CASE_TITLE')) {
  48020. define('MB_CASE_TITLE', 2);
  48021. }
  48022. <?php
  48023. namespace Symfony\Component\Process\Exception;
  48024. interface ExceptionInterface
  48025. {
  48026. }
  48027. <?php
  48028. namespace Symfony\Component\Process\Exception;
  48029. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48030. {
  48031. }
  48032. <?php
  48033. namespace Symfony\Component\Process\Exception;
  48034. class LogicException extends \LogicException implements ExceptionInterface
  48035. {
  48036. }
  48037. <?php
  48038. namespace Symfony\Component\Process\Exception;
  48039. use Symfony\Component\Process\Process;
  48040. class ProcessFailedException extends RuntimeException
  48041. {
  48042. private $process;
  48043. public function __construct(Process $process)
  48044. {
  48045. if ($process->isSuccessful()) {
  48046. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  48047. }
  48048. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  48049. $process->getCommandLine(),
  48050. $process->getExitCode(),
  48051. $process->getExitCodeText(),
  48052. $process->getWorkingDirectory()
  48053. );
  48054. if (!$process->isOutputDisabled()) {
  48055. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  48056. $process->getOutput(),
  48057. $process->getErrorOutput()
  48058. );
  48059. }
  48060. parent::__construct($error);
  48061. $this->process = $process;
  48062. }
  48063. public function getProcess()
  48064. {
  48065. return $this->process;
  48066. }
  48067. }
  48068. <?php
  48069. namespace Symfony\Component\Process\Exception;
  48070. use Symfony\Component\Process\Process;
  48071. class ProcessTimedOutException extends RuntimeException
  48072. {
  48073. const TYPE_GENERAL = 1;
  48074. const TYPE_IDLE = 2;
  48075. private $process;
  48076. private $timeoutType;
  48077. public function __construct(Process $process, $timeoutType)
  48078. {
  48079. $this->process = $process;
  48080. $this->timeoutType = $timeoutType;
  48081. parent::__construct(sprintf(
  48082. 'The process "%s" exceeded the timeout of %s seconds.',
  48083. $process->getCommandLine(),
  48084. $this->getExceededTimeout()
  48085. ));
  48086. }
  48087. public function getProcess()
  48088. {
  48089. return $this->process;
  48090. }
  48091. public function isGeneralTimeout()
  48092. {
  48093. return self::TYPE_GENERAL === $this->timeoutType;
  48094. }
  48095. public function isIdleTimeout()
  48096. {
  48097. return self::TYPE_IDLE === $this->timeoutType;
  48098. }
  48099. public function getExceededTimeout()
  48100. {
  48101. switch ($this->timeoutType) {
  48102. case self::TYPE_GENERAL:
  48103. return $this->process->getTimeout();
  48104. case self::TYPE_IDLE:
  48105. return $this->process->getIdleTimeout();
  48106. default:
  48107. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  48108. }
  48109. }
  48110. }
  48111. <?php
  48112. namespace Symfony\Component\Process\Exception;
  48113. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48114. {
  48115. }
  48116. <?php
  48117. namespace Symfony\Component\Process;
  48118. class ExecutableFinder
  48119. {
  48120. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  48121. public function setSuffixes(array $suffixes)
  48122. {
  48123. $this->suffixes = $suffixes;
  48124. }
  48125. public function addSuffix($suffix)
  48126. {
  48127. $this->suffixes[] = $suffix;
  48128. }
  48129. public function find($name, $default = null, array $extraDirs = array())
  48130. {
  48131. if (ini_get('open_basedir')) {
  48132. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  48133. $dirs = array();
  48134. foreach ($searchPath as $path) {
  48135. if (@is_dir($path)) {
  48136. $dirs[] = $path;
  48137. } else {
  48138. if (basename($path) == $name && @is_executable($path)) {
  48139. return $path;
  48140. }
  48141. }
  48142. }
  48143. } else {
  48144. $dirs = array_merge(
  48145. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  48146. $extraDirs
  48147. );
  48148. }
  48149. $suffixes = array('');
  48150. if ('\\' === \DIRECTORY_SEPARATOR) {
  48151. $pathExt = getenv('PATHEXT');
  48152. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  48153. }
  48154. foreach ($suffixes as $suffix) {
  48155. foreach ($dirs as $dir) {
  48156. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  48157. return $file;
  48158. }
  48159. }
  48160. }
  48161. return $default;
  48162. }
  48163. }
  48164. Copyright (c) 2004-2018 Fabien Potencier
  48165. Permission is hereby granted, free of charge, to any person obtaining a copy
  48166. of this software and associated documentation files (the "Software"), to deal
  48167. in the Software without restriction, including without limitation the rights
  48168. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48169. copies of the Software, and to permit persons to whom the Software is furnished
  48170. to do so, subject to the following conditions:
  48171. The above copyright notice and this permission notice shall be included in all
  48172. copies or substantial portions of the Software.
  48173. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48174. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48175. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48176. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48177. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48178. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  48179. THE SOFTWARE.
  48180. <?php
  48181. namespace Symfony\Component\Process;
  48182. class PhpExecutableFinder
  48183. {
  48184. private $executableFinder;
  48185. public function __construct()
  48186. {
  48187. $this->executableFinder = new ExecutableFinder();
  48188. }
  48189. public function find($includeArgs = true)
  48190. {
  48191. $args = $this->findArguments();
  48192. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  48193. if (\defined('HHVM_VERSION')) {
  48194. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  48195. }
  48196. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  48197. return PHP_BINARY.$args;
  48198. }
  48199. if ($php = getenv('PHP_PATH')) {
  48200. if (!@is_executable($php)) {
  48201. return false;
  48202. }
  48203. return $php;
  48204. }
  48205. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  48206. if (@is_executable($php)) {
  48207. return $php;
  48208. }
  48209. }
  48210. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  48211. return $php;
  48212. }
  48213. $dirs = array(PHP_BINDIR);
  48214. if ('\\' === \DIRECTORY_SEPARATOR) {
  48215. $dirs[] = 'C:\xampp\php\\';
  48216. }
  48217. return $this->executableFinder->find('php', false, $dirs);
  48218. }
  48219. public function findArguments()
  48220. {
  48221. $arguments = array();
  48222. if (\defined('HHVM_VERSION')) {
  48223. $arguments[] = '--php';
  48224. } elseif ('phpdbg' === \PHP_SAPI) {
  48225. $arguments[] = '-qrr';
  48226. }
  48227. return $arguments;
  48228. }
  48229. }
  48230. <?php
  48231. namespace Symfony\Component\Process;
  48232. use Symfony\Component\Process\Exception\RuntimeException;
  48233. class PhpProcess extends Process
  48234. {
  48235. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  48236. {
  48237. $executableFinder = new PhpExecutableFinder();
  48238. if (false === $php = $executableFinder->find()) {
  48239. $php = null;
  48240. }
  48241. if ('phpdbg' === \PHP_SAPI) {
  48242. $file = tempnam(sys_get_temp_dir(), 'dbg');
  48243. file_put_contents($file, $script);
  48244. register_shutdown_function('unlink', $file);
  48245. $php .= ' '.ProcessUtils::escapeArgument($file);
  48246. $script = null;
  48247. }
  48248. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  48249. $php = 'exec '.$php;
  48250. }
  48251. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  48252. }
  48253. public function setPhpBinary($php)
  48254. {
  48255. $this->setCommandLine($php);
  48256. }
  48257. public function start($callback = null)
  48258. {
  48259. if (null === $this->getCommandLine()) {
  48260. throw new RuntimeException('Unable to find the PHP executable.');
  48261. }
  48262. parent::start($callback);
  48263. }
  48264. }
  48265. <?php
  48266. namespace Symfony\Component\Process\Pipes;
  48267. abstract class AbstractPipes implements PipesInterface
  48268. {
  48269. public $pipes = array();
  48270. private $inputBuffer = '';
  48271. private $input;
  48272. private $blocked = true;
  48273. private $lastError;
  48274. public function __construct($input)
  48275. {
  48276. if (\is_resource($input)) {
  48277. $this->input = $input;
  48278. } elseif (\is_string($input)) {
  48279. $this->inputBuffer = $input;
  48280. } else {
  48281. $this->inputBuffer = (string) $input;
  48282. }
  48283. }
  48284. public function close()
  48285. {
  48286. foreach ($this->pipes as $pipe) {
  48287. fclose($pipe);
  48288. }
  48289. $this->pipes = array();
  48290. }
  48291. protected function hasSystemCallBeenInterrupted()
  48292. {
  48293. $lastError = $this->lastError;
  48294. $this->lastError = null;
  48295. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  48296. }
  48297. protected function unblock()
  48298. {
  48299. if (!$this->blocked) {
  48300. return;
  48301. }
  48302. foreach ($this->pipes as $pipe) {
  48303. stream_set_blocking($pipe, 0);
  48304. }
  48305. if (null !== $this->input) {
  48306. stream_set_blocking($this->input, 0);
  48307. }
  48308. $this->blocked = false;
  48309. }
  48310. protected function write()
  48311. {
  48312. if (!isset($this->pipes[0])) {
  48313. return;
  48314. }
  48315. $input = $this->input;
  48316. $r = $e = array();
  48317. $w = array($this->pipes[0]);
  48318. if (false === @stream_select($r, $w, $e, 0, 0)) {
  48319. return;
  48320. }
  48321. foreach ($w as $stdin) {
  48322. if (isset($this->inputBuffer[0])) {
  48323. $written = fwrite($stdin, $this->inputBuffer);
  48324. $this->inputBuffer = substr($this->inputBuffer, $written);
  48325. if (isset($this->inputBuffer[0])) {
  48326. return array($this->pipes[0]);
  48327. }
  48328. }
  48329. if ($input) {
  48330. for (;;) {
  48331. $data = fread($input, self::CHUNK_SIZE);
  48332. if (!isset($data[0])) {
  48333. break;
  48334. }
  48335. $written = fwrite($stdin, $data);
  48336. $data = substr($data, $written);
  48337. if (isset($data[0])) {
  48338. $this->inputBuffer = $data;
  48339. return array($this->pipes[0]);
  48340. }
  48341. }
  48342. if (feof($input)) {
  48343. $this->input = null;
  48344. }
  48345. }
  48346. }
  48347. if (null === $this->input && !isset($this->inputBuffer[0])) {
  48348. fclose($this->pipes[0]);
  48349. unset($this->pipes[0]);
  48350. } elseif (!$w) {
  48351. return array($this->pipes[0]);
  48352. }
  48353. }
  48354. public function handleError($type, $msg)
  48355. {
  48356. $this->lastError = $msg;
  48357. }
  48358. }
  48359. <?php
  48360. namespace Symfony\Component\Process\Pipes;
  48361. interface PipesInterface
  48362. {
  48363. const CHUNK_SIZE = 16384;
  48364. public function getDescriptors();
  48365. public function getFiles();
  48366. public function readAndWrite($blocking, $close = false);
  48367. public function areOpen();
  48368. public function close();
  48369. }
  48370. <?php
  48371. namespace Symfony\Component\Process\Pipes;
  48372. use Symfony\Component\Process\Process;
  48373. class UnixPipes extends AbstractPipes
  48374. {
  48375. private $ttyMode;
  48376. private $ptyMode;
  48377. private $disableOutput;
  48378. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  48379. {
  48380. $this->ttyMode = (bool) $ttyMode;
  48381. $this->ptyMode = (bool) $ptyMode;
  48382. $this->disableOutput = (bool) $disableOutput;
  48383. parent::__construct($input);
  48384. }
  48385. public function __destruct()
  48386. {
  48387. $this->close();
  48388. }
  48389. public function getDescriptors()
  48390. {
  48391. if ($this->disableOutput) {
  48392. $nullstream = fopen('/dev/null', 'c');
  48393. return array(
  48394. array('pipe', 'r'),
  48395. $nullstream,
  48396. $nullstream,
  48397. );
  48398. }
  48399. if ($this->ttyMode) {
  48400. return array(
  48401. array('file', '/dev/tty', 'r'),
  48402. array('file', '/dev/tty', 'w'),
  48403. array('file', '/dev/tty', 'w'),
  48404. );
  48405. }
  48406. if ($this->ptyMode && Process::isPtySupported()) {
  48407. return array(
  48408. array('pty'),
  48409. array('pty'),
  48410. array('pty'),
  48411. );
  48412. }
  48413. return array(
  48414. array('pipe', 'r'),
  48415. array('pipe', 'w'),
  48416. array('pipe', 'w'),
  48417. );
  48418. }
  48419. public function getFiles()
  48420. {
  48421. return array();
  48422. }
  48423. public function readAndWrite($blocking, $close = false)
  48424. {
  48425. $this->unblock();
  48426. $w = $this->write();
  48427. $read = $e = array();
  48428. $r = $this->pipes;
  48429. unset($r[0]);
  48430. set_error_handler(array($this, 'handleError'));
  48431. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  48432. restore_error_handler();
  48433. if (!$this->hasSystemCallBeenInterrupted()) {
  48434. $this->pipes = array();
  48435. }
  48436. return $read;
  48437. }
  48438. restore_error_handler();
  48439. foreach ($r as $pipe) {
  48440. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  48441. do {
  48442. $data = fread($pipe, self::CHUNK_SIZE);
  48443. $read[$type] .= $data;
  48444. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  48445. if (!isset($read[$type][0])) {
  48446. unset($read[$type]);
  48447. }
  48448. if ($close && feof($pipe)) {
  48449. fclose($pipe);
  48450. unset($this->pipes[$type]);
  48451. }
  48452. }
  48453. return $read;
  48454. }
  48455. public function areOpen()
  48456. {
  48457. return (bool) $this->pipes;
  48458. }
  48459. public static function create(Process $process, $input)
  48460. {
  48461. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  48462. }
  48463. }
  48464. <?php
  48465. namespace Symfony\Component\Process\Pipes;
  48466. use Symfony\Component\Process\Exception\RuntimeException;
  48467. use Symfony\Component\Process\Process;
  48468. class WindowsPipes extends AbstractPipes
  48469. {
  48470. private $files = array();
  48471. private $fileHandles = array();
  48472. private $lockHandles = array();
  48473. private $readBytes = array(
  48474. Process::STDOUT => 0,
  48475. Process::STDERR => 0,
  48476. );
  48477. private $disableOutput;
  48478. public function __construct($disableOutput, $input)
  48479. {
  48480. $this->disableOutput = (bool) $disableOutput;
  48481. if (!$this->disableOutput) {
  48482. $pipes = array(
  48483. Process::STDOUT => Process::OUT,
  48484. Process::STDERR => Process::ERR,
  48485. );
  48486. $tmpDir = sys_get_temp_dir();
  48487. $lastError = 'unknown reason';
  48488. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  48489. for ($i = 0;; ++$i) {
  48490. foreach ($pipes as $pipe => $name) {
  48491. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  48492. if (!$h = fopen($file.'.lock', 'w')) {
  48493. restore_error_handler();
  48494. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  48495. }
  48496. if (!flock($h, LOCK_EX | LOCK_NB)) {
  48497. continue 2;
  48498. }
  48499. if (isset($this->lockHandles[$pipe])) {
  48500. flock($this->lockHandles[$pipe], LOCK_UN);
  48501. fclose($this->lockHandles[$pipe]);
  48502. }
  48503. $this->lockHandles[$pipe] = $h;
  48504. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  48505. flock($this->lockHandles[$pipe], LOCK_UN);
  48506. fclose($this->lockHandles[$pipe]);
  48507. unset($this->lockHandles[$pipe]);
  48508. continue 2;
  48509. }
  48510. $this->fileHandles[$pipe] = $h;
  48511. $this->files[$pipe] = $file;
  48512. }
  48513. break;
  48514. }
  48515. restore_error_handler();
  48516. }
  48517. parent::__construct($input);
  48518. }
  48519. public function __destruct()
  48520. {
  48521. $this->close();
  48522. }
  48523. public function getDescriptors()
  48524. {
  48525. if ($this->disableOutput) {
  48526. $nullstream = fopen('NUL', 'c');
  48527. return array(
  48528. array('pipe', 'r'),
  48529. $nullstream,
  48530. $nullstream,
  48531. );
  48532. }
  48533. return array(
  48534. array('pipe', 'r'),
  48535. array('file', 'NUL', 'w'),
  48536. array('file', 'NUL', 'w'),
  48537. );
  48538. }
  48539. public function getFiles()
  48540. {
  48541. return $this->files;
  48542. }
  48543. public function readAndWrite($blocking, $close = false)
  48544. {
  48545. $this->unblock();
  48546. $w = $this->write();
  48547. $read = $r = $e = array();
  48548. if ($blocking) {
  48549. if ($w) {
  48550. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  48551. } elseif ($this->fileHandles) {
  48552. usleep(Process::TIMEOUT_PRECISION * 1E6);
  48553. }
  48554. }
  48555. foreach ($this->fileHandles as $type => $fileHandle) {
  48556. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  48557. if (isset($data[0])) {
  48558. $this->readBytes[$type] += \strlen($data);
  48559. $read[$type] = $data;
  48560. }
  48561. if ($close) {
  48562. ftruncate($fileHandle, 0);
  48563. fclose($fileHandle);
  48564. flock($this->lockHandles[$type], LOCK_UN);
  48565. fclose($this->lockHandles[$type]);
  48566. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  48567. }
  48568. }
  48569. return $read;
  48570. }
  48571. public function areOpen()
  48572. {
  48573. return $this->pipes && $this->fileHandles;
  48574. }
  48575. public function close()
  48576. {
  48577. parent::close();
  48578. foreach ($this->fileHandles as $type => $handle) {
  48579. ftruncate($handle, 0);
  48580. fclose($handle);
  48581. flock($this->lockHandles[$type], LOCK_UN);
  48582. fclose($this->lockHandles[$type]);
  48583. }
  48584. $this->fileHandles = $this->lockHandles = array();
  48585. }
  48586. public static function create(Process $process, $input)
  48587. {
  48588. return new static($process->isOutputDisabled(), $input);
  48589. }
  48590. }
  48591. <?php
  48592. namespace Symfony\Component\Process;
  48593. use Symfony\Component\Process\Exception\InvalidArgumentException;
  48594. use Symfony\Component\Process\Exception\LogicException;
  48595. use Symfony\Component\Process\Exception\ProcessFailedException;
  48596. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  48597. use Symfony\Component\Process\Exception\RuntimeException;
  48598. use Symfony\Component\Process\Pipes\PipesInterface;
  48599. use Symfony\Component\Process\Pipes\UnixPipes;
  48600. use Symfony\Component\Process\Pipes\WindowsPipes;
  48601. class Process
  48602. {
  48603. const ERR = 'err';
  48604. const OUT = 'out';
  48605. const STATUS_READY = 'ready';
  48606. const STATUS_STARTED = 'started';
  48607. const STATUS_TERMINATED = 'terminated';
  48608. const STDIN = 0;
  48609. const STDOUT = 1;
  48610. const STDERR = 2;
  48611. const TIMEOUT_PRECISION = 0.2;
  48612. private $callback;
  48613. private $commandline;
  48614. private $cwd;
  48615. private $env;
  48616. private $input;
  48617. private $starttime;
  48618. private $lastOutputTime;
  48619. private $timeout;
  48620. private $idleTimeout;
  48621. private $options;
  48622. private $exitcode;
  48623. private $fallbackStatus = array();
  48624. private $processInformation;
  48625. private $outputDisabled = false;
  48626. private $stdout;
  48627. private $stderr;
  48628. private $enhanceWindowsCompatibility = true;
  48629. private $enhanceSigchildCompatibility;
  48630. private $process;
  48631. private $status = self::STATUS_READY;
  48632. private $incrementalOutputOffset = 0;
  48633. private $incrementalErrorOutputOffset = 0;
  48634. private $tty;
  48635. private $pty;
  48636. private $useFileHandles = false;
  48637. private $processPipes;
  48638. private $latestSignal;
  48639. private static $sigchild;
  48640. public static $exitCodes = array(
  48641. 0 => 'OK',
  48642. 1 => 'General error',
  48643. 2 => 'Misuse of shell builtins',
  48644. 126 => 'Invoked command cannot execute',
  48645. 127 => 'Command not found',
  48646. 128 => 'Invalid exit argument',
  48647. 129 => 'Hangup',
  48648. 130 => 'Interrupt',
  48649. 131 => 'Quit and dump core',
  48650. 132 => 'Illegal instruction',
  48651. 133 => 'Trace/breakpoint trap',
  48652. 134 => 'Process aborted',
  48653. 135 => 'Bus error: "access to undefined portion of memory object"',
  48654. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  48655. 137 => 'Kill (terminate immediately)',
  48656. 138 => 'User-defined 1',
  48657. 139 => 'Segmentation violation',
  48658. 140 => 'User-defined 2',
  48659. 141 => 'Write to pipe with no one reading',
  48660. 142 => 'Signal raised by alarm',
  48661. 143 => 'Termination (request to terminate)',
  48662. 145 => 'Child process terminated, stopped (or continued*)',
  48663. 146 => 'Continue if stopped',
  48664. 147 => 'Stop executing temporarily',
  48665. 148 => 'Terminal stop signal',
  48666. 149 => 'Background process attempting to read from tty ("in")',
  48667. 150 => 'Background process attempting to write to tty ("out")',
  48668. 151 => 'Urgent data available on socket',
  48669. 152 => 'CPU time limit exceeded',
  48670. 153 => 'File size limit exceeded',
  48671. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  48672. 155 => 'Profiling timer expired',
  48673. 157 => 'Pollable event',
  48674. 159 => 'Bad syscall',
  48675. );
  48676. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  48677. {
  48678. if (!\function_exists('proc_open')) {
  48679. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  48680. }
  48681. $this->commandline = $commandline;
  48682. $this->cwd = $cwd;
  48683. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  48684. $this->cwd = getcwd();
  48685. }
  48686. if (null !== $env) {
  48687. $this->setEnv($env);
  48688. }
  48689. $this->setInput($input);
  48690. $this->setTimeout($timeout);
  48691. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  48692. $this->pty = false;
  48693. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  48694. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  48695. }
  48696. public function __destruct()
  48697. {
  48698. $this->stop(0);
  48699. }
  48700. public function __clone()
  48701. {
  48702. $this->resetProcessData();
  48703. }
  48704. public function run($callback = null)
  48705. {
  48706. $this->start($callback);
  48707. return $this->wait();
  48708. }
  48709. public function mustRun($callback = null)
  48710. {
  48711. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48712. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48713. }
  48714. if (0 !== $this->run($callback)) {
  48715. throw new ProcessFailedException($this);
  48716. }
  48717. return $this;
  48718. }
  48719. public function start($callback = null)
  48720. {
  48721. if ($this->isRunning()) {
  48722. throw new RuntimeException('Process is already running');
  48723. }
  48724. if ($this->outputDisabled && null !== $callback) {
  48725. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  48726. }
  48727. $this->resetProcessData();
  48728. $this->starttime = $this->lastOutputTime = microtime(true);
  48729. $this->callback = $this->buildCallback($callback);
  48730. $descriptors = $this->getDescriptors();
  48731. $commandline = $this->commandline;
  48732. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  48733. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  48734. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  48735. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  48736. }
  48737. $commandline .= '"';
  48738. if (!isset($this->options['bypass_shell'])) {
  48739. $this->options['bypass_shell'] = true;
  48740. }
  48741. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48742. $descriptors[3] = array('pipe', 'w');
  48743. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  48744. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  48745. $ptsWorkaround = fopen(__FILE__, 'r');
  48746. }
  48747. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  48748. if (!\is_resource($this->process)) {
  48749. throw new RuntimeException('Unable to launch a new process.');
  48750. }
  48751. $this->status = self::STATUS_STARTED;
  48752. if (isset($descriptors[3])) {
  48753. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  48754. }
  48755. if ($this->tty) {
  48756. return;
  48757. }
  48758. $this->updateStatus(false);
  48759. $this->checkTimeout();
  48760. }
  48761. public function restart($callback = null)
  48762. {
  48763. if ($this->isRunning()) {
  48764. throw new RuntimeException('Process is already running');
  48765. }
  48766. $process = clone $this;
  48767. $process->start($callback);
  48768. return $process;
  48769. }
  48770. public function wait($callback = null)
  48771. {
  48772. $this->requireProcessIsStarted(__FUNCTION__);
  48773. $this->updateStatus(false);
  48774. if (null !== $callback) {
  48775. $this->callback = $this->buildCallback($callback);
  48776. }
  48777. do {
  48778. $this->checkTimeout();
  48779. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  48780. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  48781. } while ($running);
  48782. while ($this->isRunning()) {
  48783. usleep(1000);
  48784. }
  48785. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  48786. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  48787. }
  48788. return $this->exitcode;
  48789. }
  48790. public function getPid()
  48791. {
  48792. return $this->isRunning() ? $this->processInformation['pid'] : null;
  48793. }
  48794. public function signal($signal)
  48795. {
  48796. $this->doSignal($signal, true);
  48797. return $this;
  48798. }
  48799. public function disableOutput()
  48800. {
  48801. if ($this->isRunning()) {
  48802. throw new RuntimeException('Disabling output while the process is running is not possible.');
  48803. }
  48804. if (null !== $this->idleTimeout) {
  48805. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  48806. }
  48807. $this->outputDisabled = true;
  48808. return $this;
  48809. }
  48810. public function enableOutput()
  48811. {
  48812. if ($this->isRunning()) {
  48813. throw new RuntimeException('Enabling output while the process is running is not possible.');
  48814. }
  48815. $this->outputDisabled = false;
  48816. return $this;
  48817. }
  48818. public function isOutputDisabled()
  48819. {
  48820. return $this->outputDisabled;
  48821. }
  48822. public function getOutput()
  48823. {
  48824. $this->readPipesForOutput(__FUNCTION__);
  48825. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  48826. return '';
  48827. }
  48828. return $ret;
  48829. }
  48830. public function getIncrementalOutput()
  48831. {
  48832. $this->readPipesForOutput(__FUNCTION__);
  48833. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  48834. $this->incrementalOutputOffset = ftell($this->stdout);
  48835. if (false === $latest) {
  48836. return '';
  48837. }
  48838. return $latest;
  48839. }
  48840. public function clearOutput()
  48841. {
  48842. ftruncate($this->stdout, 0);
  48843. fseek($this->stdout, 0);
  48844. $this->incrementalOutputOffset = 0;
  48845. return $this;
  48846. }
  48847. public function getErrorOutput()
  48848. {
  48849. $this->readPipesForOutput(__FUNCTION__);
  48850. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  48851. return '';
  48852. }
  48853. return $ret;
  48854. }
  48855. public function getIncrementalErrorOutput()
  48856. {
  48857. $this->readPipesForOutput(__FUNCTION__);
  48858. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  48859. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  48860. if (false === $latest) {
  48861. return '';
  48862. }
  48863. return $latest;
  48864. }
  48865. public function clearErrorOutput()
  48866. {
  48867. ftruncate($this->stderr, 0);
  48868. fseek($this->stderr, 0);
  48869. $this->incrementalErrorOutputOffset = 0;
  48870. return $this;
  48871. }
  48872. public function getExitCode()
  48873. {
  48874. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48875. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48876. }
  48877. $this->updateStatus(false);
  48878. return $this->exitcode;
  48879. }
  48880. public function getExitCodeText()
  48881. {
  48882. if (null === $exitcode = $this->getExitCode()) {
  48883. return;
  48884. }
  48885. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  48886. }
  48887. public function isSuccessful()
  48888. {
  48889. return 0 === $this->getExitCode();
  48890. }
  48891. public function hasBeenSignaled()
  48892. {
  48893. $this->requireProcessIsTerminated(__FUNCTION__);
  48894. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48895. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48896. }
  48897. return $this->processInformation['signaled'];
  48898. }
  48899. public function getTermSignal()
  48900. {
  48901. $this->requireProcessIsTerminated(__FUNCTION__);
  48902. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  48903. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48904. }
  48905. return $this->processInformation['termsig'];
  48906. }
  48907. public function hasBeenStopped()
  48908. {
  48909. $this->requireProcessIsTerminated(__FUNCTION__);
  48910. return $this->processInformation['stopped'];
  48911. }
  48912. public function getStopSignal()
  48913. {
  48914. $this->requireProcessIsTerminated(__FUNCTION__);
  48915. return $this->processInformation['stopsig'];
  48916. }
  48917. public function isRunning()
  48918. {
  48919. if (self::STATUS_STARTED !== $this->status) {
  48920. return false;
  48921. }
  48922. $this->updateStatus(false);
  48923. return $this->processInformation['running'];
  48924. }
  48925. public function isStarted()
  48926. {
  48927. return self::STATUS_READY != $this->status;
  48928. }
  48929. public function isTerminated()
  48930. {
  48931. $this->updateStatus(false);
  48932. return self::STATUS_TERMINATED == $this->status;
  48933. }
  48934. public function getStatus()
  48935. {
  48936. $this->updateStatus(false);
  48937. return $this->status;
  48938. }
  48939. public function stop($timeout = 10, $signal = null)
  48940. {
  48941. $timeoutMicro = microtime(true) + $timeout;
  48942. if ($this->isRunning()) {
  48943. $this->doSignal(15, false);
  48944. do {
  48945. usleep(1000);
  48946. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  48947. if ($this->isRunning()) {
  48948. $this->doSignal($signal ?: 9, false);
  48949. }
  48950. }
  48951. if ($this->isRunning()) {
  48952. if (isset($this->fallbackStatus['pid'])) {
  48953. unset($this->fallbackStatus['pid']);
  48954. return $this->stop(0, $signal);
  48955. }
  48956. $this->close();
  48957. }
  48958. return $this->exitcode;
  48959. }
  48960. public function addOutput($line)
  48961. {
  48962. $this->lastOutputTime = microtime(true);
  48963. fseek($this->stdout, 0, SEEK_END);
  48964. fwrite($this->stdout, $line);
  48965. fseek($this->stdout, $this->incrementalOutputOffset);
  48966. }
  48967. public function addErrorOutput($line)
  48968. {
  48969. $this->lastOutputTime = microtime(true);
  48970. fseek($this->stderr, 0, SEEK_END);
  48971. fwrite($this->stderr, $line);
  48972. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  48973. }
  48974. public function getCommandLine()
  48975. {
  48976. return $this->commandline;
  48977. }
  48978. public function setCommandLine($commandline)
  48979. {
  48980. $this->commandline = $commandline;
  48981. return $this;
  48982. }
  48983. public function getTimeout()
  48984. {
  48985. return $this->timeout;
  48986. }
  48987. public function getIdleTimeout()
  48988. {
  48989. return $this->idleTimeout;
  48990. }
  48991. public function setTimeout($timeout)
  48992. {
  48993. $this->timeout = $this->validateTimeout($timeout);
  48994. return $this;
  48995. }
  48996. public function setIdleTimeout($timeout)
  48997. {
  48998. if (null !== $timeout && $this->outputDisabled) {
  48999. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  49000. }
  49001. $this->idleTimeout = $this->validateTimeout($timeout);
  49002. return $this;
  49003. }
  49004. public function setTty($tty)
  49005. {
  49006. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  49007. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  49008. }
  49009. if ($tty) {
  49010. static $isTtySupported;
  49011. if (null === $isTtySupported) {
  49012. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  49013. }
  49014. if (!$isTtySupported) {
  49015. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  49016. }
  49017. }
  49018. $this->tty = (bool) $tty;
  49019. return $this;
  49020. }
  49021. public function isTty()
  49022. {
  49023. return $this->tty;
  49024. }
  49025. public function setPty($bool)
  49026. {
  49027. $this->pty = (bool) $bool;
  49028. return $this;
  49029. }
  49030. public function isPty()
  49031. {
  49032. return $this->pty;
  49033. }
  49034. public function getWorkingDirectory()
  49035. {
  49036. if (null === $this->cwd) {
  49037. return getcwd() ?: null;
  49038. }
  49039. return $this->cwd;
  49040. }
  49041. public function setWorkingDirectory($cwd)
  49042. {
  49043. $this->cwd = $cwd;
  49044. return $this;
  49045. }
  49046. public function getEnv()
  49047. {
  49048. return $this->env;
  49049. }
  49050. public function setEnv(array $env)
  49051. {
  49052. $env = array_filter($env, function ($value) {
  49053. return !\is_array($value);
  49054. });
  49055. $this->env = array();
  49056. foreach ($env as $key => $value) {
  49057. $this->env[$key] = (string) $value;
  49058. }
  49059. return $this;
  49060. }
  49061. public function getStdin()
  49062. {
  49063. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  49064. return $this->getInput();
  49065. }
  49066. public function getInput()
  49067. {
  49068. return $this->input;
  49069. }
  49070. public function setStdin($stdin)
  49071. {
  49072. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  49073. return $this->setInput($stdin);
  49074. }
  49075. public function setInput($input)
  49076. {
  49077. if ($this->isRunning()) {
  49078. throw new LogicException('Input can not be set while the process is running.');
  49079. }
  49080. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49081. return $this;
  49082. }
  49083. public function getOptions()
  49084. {
  49085. return $this->options;
  49086. }
  49087. public function setOptions(array $options)
  49088. {
  49089. $this->options = $options;
  49090. return $this;
  49091. }
  49092. public function getEnhanceWindowsCompatibility()
  49093. {
  49094. return $this->enhanceWindowsCompatibility;
  49095. }
  49096. public function setEnhanceWindowsCompatibility($enhance)
  49097. {
  49098. $this->enhanceWindowsCompatibility = (bool) $enhance;
  49099. return $this;
  49100. }
  49101. public function getEnhanceSigchildCompatibility()
  49102. {
  49103. return $this->enhanceSigchildCompatibility;
  49104. }
  49105. public function setEnhanceSigchildCompatibility($enhance)
  49106. {
  49107. $this->enhanceSigchildCompatibility = (bool) $enhance;
  49108. return $this;
  49109. }
  49110. public function checkTimeout()
  49111. {
  49112. if (self::STATUS_STARTED !== $this->status) {
  49113. return;
  49114. }
  49115. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  49116. $this->stop(0);
  49117. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  49118. }
  49119. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  49120. $this->stop(0);
  49121. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  49122. }
  49123. }
  49124. public static function isPtySupported()
  49125. {
  49126. static $result;
  49127. if (null !== $result) {
  49128. return $result;
  49129. }
  49130. if ('\\' === \DIRECTORY_SEPARATOR) {
  49131. return $result = false;
  49132. }
  49133. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  49134. }
  49135. private function getDescriptors()
  49136. {
  49137. if ('\\' === \DIRECTORY_SEPARATOR) {
  49138. $this->processPipes = WindowsPipes::create($this, $this->input);
  49139. } else {
  49140. $this->processPipes = UnixPipes::create($this, $this->input);
  49141. }
  49142. return $this->processPipes->getDescriptors();
  49143. }
  49144. protected function buildCallback($callback)
  49145. {
  49146. $that = $this;
  49147. $out = self::OUT;
  49148. $callback = function ($type, $data) use ($that, $callback, $out) {
  49149. if ($out == $type) {
  49150. $that->addOutput($data);
  49151. } else {
  49152. $that->addErrorOutput($data);
  49153. }
  49154. if (null !== $callback) {
  49155. \call_user_func($callback, $type, $data);
  49156. }
  49157. };
  49158. return $callback;
  49159. }
  49160. protected function updateStatus($blocking)
  49161. {
  49162. if (self::STATUS_STARTED !== $this->status) {
  49163. return;
  49164. }
  49165. $this->processInformation = proc_get_status($this->process);
  49166. $running = $this->processInformation['running'];
  49167. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  49168. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49169. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  49170. }
  49171. if (!$running) {
  49172. $this->close();
  49173. }
  49174. }
  49175. protected function isSigchildEnabled()
  49176. {
  49177. if (null !== self::$sigchild) {
  49178. return self::$sigchild;
  49179. }
  49180. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  49181. return self::$sigchild = false;
  49182. }
  49183. ob_start();
  49184. phpinfo(INFO_GENERAL);
  49185. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  49186. }
  49187. private function readPipesForOutput($caller)
  49188. {
  49189. if ($this->outputDisabled) {
  49190. throw new LogicException('Output has been disabled.');
  49191. }
  49192. $this->requireProcessIsStarted($caller);
  49193. $this->updateStatus(false);
  49194. }
  49195. private function validateTimeout($timeout)
  49196. {
  49197. $timeout = (float) $timeout;
  49198. if (0.0 === $timeout) {
  49199. $timeout = null;
  49200. } elseif ($timeout < 0) {
  49201. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49202. }
  49203. return $timeout;
  49204. }
  49205. private function readPipes($blocking, $close)
  49206. {
  49207. $result = $this->processPipes->readAndWrite($blocking, $close);
  49208. $callback = $this->callback;
  49209. foreach ($result as $type => $data) {
  49210. if (3 !== $type) {
  49211. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  49212. } elseif (!isset($this->fallbackStatus['signaled'])) {
  49213. $this->fallbackStatus['exitcode'] = (int) $data;
  49214. }
  49215. }
  49216. }
  49217. private function close()
  49218. {
  49219. $this->processPipes->close();
  49220. if (\is_resource($this->process)) {
  49221. proc_close($this->process);
  49222. }
  49223. $this->exitcode = $this->processInformation['exitcode'];
  49224. $this->status = self::STATUS_TERMINATED;
  49225. if (-1 === $this->exitcode) {
  49226. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  49227. $this->exitcode = 128 + $this->processInformation['termsig'];
  49228. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49229. $this->processInformation['signaled'] = true;
  49230. $this->processInformation['termsig'] = -1;
  49231. }
  49232. }
  49233. $this->callback = null;
  49234. return $this->exitcode;
  49235. }
  49236. private function resetProcessData()
  49237. {
  49238. $this->starttime = null;
  49239. $this->callback = null;
  49240. $this->exitcode = null;
  49241. $this->fallbackStatus = array();
  49242. $this->processInformation = null;
  49243. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49244. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49245. $this->process = null;
  49246. $this->latestSignal = null;
  49247. $this->status = self::STATUS_READY;
  49248. $this->incrementalOutputOffset = 0;
  49249. $this->incrementalErrorOutputOffset = 0;
  49250. }
  49251. private function doSignal($signal, $throwException)
  49252. {
  49253. if (null === $pid = $this->getPid()) {
  49254. if ($throwException) {
  49255. throw new LogicException('Can not send signal on a non running process.');
  49256. }
  49257. return false;
  49258. }
  49259. if ('\\' === \DIRECTORY_SEPARATOR) {
  49260. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  49261. if ($exitCode && $this->isRunning()) {
  49262. if ($throwException) {
  49263. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  49264. }
  49265. return false;
  49266. }
  49267. } else {
  49268. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  49269. $ok = @proc_terminate($this->process, $signal);
  49270. } elseif (\function_exists('posix_kill')) {
  49271. $ok = @posix_kill($pid, $signal);
  49272. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  49273. $ok = false === fgets($pipes[2]);
  49274. }
  49275. if (!$ok) {
  49276. if ($throwException) {
  49277. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  49278. }
  49279. return false;
  49280. }
  49281. }
  49282. $this->latestSignal = (int) $signal;
  49283. $this->fallbackStatus['signaled'] = true;
  49284. $this->fallbackStatus['exitcode'] = -1;
  49285. $this->fallbackStatus['termsig'] = $this->latestSignal;
  49286. return true;
  49287. }
  49288. private function requireProcessIsStarted($functionName)
  49289. {
  49290. if (!$this->isStarted()) {
  49291. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  49292. }
  49293. }
  49294. private function requireProcessIsTerminated($functionName)
  49295. {
  49296. if (!$this->isTerminated()) {
  49297. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  49298. }
  49299. }
  49300. }
  49301. <?php
  49302. namespace Symfony\Component\Process;
  49303. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49304. use Symfony\Component\Process\Exception\LogicException;
  49305. class ProcessBuilder
  49306. {
  49307. private $arguments;
  49308. private $cwd;
  49309. private $env = array();
  49310. private $input;
  49311. private $timeout = 60;
  49312. private $options = array();
  49313. private $inheritEnv = true;
  49314. private $prefix = array();
  49315. private $outputDisabled = false;
  49316. public function __construct(array $arguments = array())
  49317. {
  49318. $this->arguments = $arguments;
  49319. }
  49320. public static function create(array $arguments = array())
  49321. {
  49322. return new static($arguments);
  49323. }
  49324. public function add($argument)
  49325. {
  49326. $this->arguments[] = $argument;
  49327. return $this;
  49328. }
  49329. public function setPrefix($prefix)
  49330. {
  49331. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  49332. return $this;
  49333. }
  49334. public function setArguments(array $arguments)
  49335. {
  49336. $this->arguments = $arguments;
  49337. return $this;
  49338. }
  49339. public function setWorkingDirectory($cwd)
  49340. {
  49341. $this->cwd = $cwd;
  49342. return $this;
  49343. }
  49344. public function inheritEnvironmentVariables($inheritEnv = true)
  49345. {
  49346. $this->inheritEnv = $inheritEnv;
  49347. return $this;
  49348. }
  49349. public function setEnv($name, $value)
  49350. {
  49351. $this->env[$name] = $value;
  49352. return $this;
  49353. }
  49354. public function addEnvironmentVariables(array $variables)
  49355. {
  49356. $this->env = array_replace($this->env, $variables);
  49357. return $this;
  49358. }
  49359. public function setInput($input)
  49360. {
  49361. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49362. return $this;
  49363. }
  49364. public function setTimeout($timeout)
  49365. {
  49366. if (null === $timeout) {
  49367. $this->timeout = null;
  49368. return $this;
  49369. }
  49370. $timeout = (float) $timeout;
  49371. if ($timeout < 0) {
  49372. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49373. }
  49374. $this->timeout = $timeout;
  49375. return $this;
  49376. }
  49377. public function setOption($name, $value)
  49378. {
  49379. $this->options[$name] = $value;
  49380. return $this;
  49381. }
  49382. public function disableOutput()
  49383. {
  49384. $this->outputDisabled = true;
  49385. return $this;
  49386. }
  49387. public function enableOutput()
  49388. {
  49389. $this->outputDisabled = false;
  49390. return $this;
  49391. }
  49392. public function getProcess()
  49393. {
  49394. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  49395. throw new LogicException('You must add() command arguments before calling getProcess().');
  49396. }
  49397. $options = $this->options;
  49398. $arguments = array_merge($this->prefix, $this->arguments);
  49399. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  49400. if ($this->inheritEnv) {
  49401. $env = array_replace($_ENV, $_SERVER, $this->env);
  49402. } else {
  49403. $env = $this->env;
  49404. }
  49405. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  49406. if ($this->outputDisabled) {
  49407. $process->disableOutput();
  49408. }
  49409. return $process;
  49410. }
  49411. }
  49412. <?php
  49413. namespace Symfony\Component\Process;
  49414. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49415. class ProcessUtils
  49416. {
  49417. private function __construct()
  49418. {
  49419. }
  49420. public static function escapeArgument($argument)
  49421. {
  49422. if ('\\' === \DIRECTORY_SEPARATOR) {
  49423. if ('' === $argument) {
  49424. return escapeshellarg($argument);
  49425. }
  49426. $escapedArgument = '';
  49427. $quote = false;
  49428. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  49429. if ('"' === $part) {
  49430. $escapedArgument .= '\\"';
  49431. } elseif (self::isSurroundedBy($part, '%')) {
  49432. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  49433. } else {
  49434. if ('\\' === substr($part, -1)) {
  49435. $part .= '\\';
  49436. }
  49437. $quote = true;
  49438. $escapedArgument .= $part;
  49439. }
  49440. }
  49441. if ($quote) {
  49442. $escapedArgument = '"'.$escapedArgument.'"';
  49443. }
  49444. return $escapedArgument;
  49445. }
  49446. return "'".str_replace("'", "'\\''", $argument)."'";
  49447. }
  49448. public static function validateInput($caller, $input)
  49449. {
  49450. if (null !== $input) {
  49451. if (\is_resource($input)) {
  49452. return $input;
  49453. }
  49454. if (\is_string($input)) {
  49455. return $input;
  49456. }
  49457. if (is_scalar($input)) {
  49458. return (string) $input;
  49459. }
  49460. if (\is_object($input) && method_exists($input, '__toString')) {
  49461. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  49462. return (string) $input;
  49463. }
  49464. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  49465. }
  49466. return $input;
  49467. }
  49468. private static function isSurroundedBy($arg, $char)
  49469. {
  49470. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  49471. }
  49472. }
  49473. Copyright (c) 2011 Jordi Boggiano
  49474. Permission is hereby granted, free of charge, to any person obtaining a copy
  49475. of this software and associated documentation files (the "Software"), to deal
  49476. in the Software without restriction, including without limitation the rights
  49477. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49478. copies of the Software, and to permit persons to whom the Software is furnished
  49479. to do so, subject to the following conditions:
  49480. The above copyright notice and this permission notice shall be included in all
  49481. copies or substantial portions of the Software.
  49482. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49483. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49484. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49485. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49486. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49487. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49488. THE SOFTWARE.
  49489. <?php
  49490. namespace Seld\JsonLint;
  49491. class DuplicateKeyException extends ParsingException
  49492. {
  49493. public function __construct($message, $key, array $details = array())
  49494. {
  49495. $details['key'] = $key;
  49496. parent::__construct($message, $details);
  49497. }
  49498. public function getKey()
  49499. {
  49500. return $this->details['key'];
  49501. }
  49502. public function getDetails()
  49503. {
  49504. return $this->details;
  49505. }
  49506. }
  49507. <?php
  49508. namespace Seld\JsonLint;
  49509. use stdClass;
  49510. class JsonParser
  49511. {
  49512. const DETECT_KEY_CONFLICTS = 1;
  49513. const ALLOW_DUPLICATE_KEYS = 2;
  49514. const PARSE_TO_ASSOC = 4;
  49515. private $lexer;
  49516. private $flags;
  49517. private $stack;
  49518. private $vstack;
  49519. private $lstack;
  49520. private $symbols = array(
  49521. 'error' => 2,
  49522. 'JSONString' => 3,
  49523. 'STRING' => 4,
  49524. 'JSONNumber' => 5,
  49525. 'NUMBER' => 6,
  49526. 'JSONNullLiteral' => 7,
  49527. 'NULL' => 8,
  49528. 'JSONBooleanLiteral' => 9,
  49529. 'TRUE' => 10,
  49530. 'FALSE' => 11,
  49531. 'JSONText' => 12,
  49532. 'JSONValue' => 13,
  49533. 'EOF' => 14,
  49534. 'JSONObject' => 15,
  49535. 'JSONArray' => 16,
  49536. '{' => 17,
  49537. '}' => 18,
  49538. 'JSONMemberList' => 19,
  49539. 'JSONMember' => 20,
  49540. ':' => 21,
  49541. ',' => 22,
  49542. '[' => 23,
  49543. ']' => 24,
  49544. 'JSONElementList' => 25,
  49545. '$accept' => 0,
  49546. '$end' => 1,
  49547. );
  49548. private $terminals_ = array(
  49549. 2 => "error",
  49550. 4 => "STRING",
  49551. 6 => "NUMBER",
  49552. 8 => "NULL",
  49553. 10 => "TRUE",
  49554. 11 => "FALSE",
  49555. 14 => "EOF",
  49556. 17 => "{",
  49557. 18 => "}",
  49558. 21 => ":",
  49559. 22 => ",",
  49560. 23 => "[",
  49561. 24 => "]",
  49562. );
  49563. private $productions_ = array(
  49564. 0,
  49565. array(3, 1),
  49566. array(5, 1),
  49567. array(7, 1),
  49568. array(9, 1),
  49569. array(9, 1),
  49570. array(12, 2),
  49571. array(13, 1),
  49572. array(13, 1),
  49573. array(13, 1),
  49574. array(13, 1),
  49575. array(13, 1),
  49576. array(13, 1),
  49577. array(15, 2),
  49578. array(15, 3),
  49579. array(20, 3),
  49580. array(19, 1),
  49581. array(19, 3),
  49582. array(16, 2),
  49583. array(16, 3),
  49584. array(25, 1),
  49585. array(25, 3)
  49586. );
  49587. private $table = array(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)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), 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 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), 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)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), 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)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  49588. );
  49589. private $defaultActions = array(
  49590. 16 => array(2, 6)
  49591. );
  49592. public function lint($input, $flags = 0)
  49593. {
  49594. try {
  49595. $this->parse($input, $flags);
  49596. } catch (ParsingException $e) {
  49597. return $e;
  49598. }
  49599. return null;
  49600. }
  49601. public function parse($input, $flags = 0)
  49602. {
  49603. $this->failOnBOM($input);
  49604. $this->flags = $flags;
  49605. $this->stack = array(0);
  49606. $this->vstack = array(null);
  49607. $this->lstack = array();
  49608. $yytext = '';
  49609. $yylineno = 0;
  49610. $yyleng = 0;
  49611. $recovering = 0;
  49612. $TERROR = 2;
  49613. $EOF = 1;
  49614. $this->lexer = new Lexer();
  49615. $this->lexer->setInput($input);
  49616. $yyloc = $this->lexer->yylloc;
  49617. $this->lstack[] = $yyloc;
  49618. $symbol = null;
  49619. $preErrorSymbol = null;
  49620. $state = null;
  49621. $action = null;
  49622. $a = null;
  49623. $r = null;
  49624. $yyval = new stdClass;
  49625. $p = null;
  49626. $len = null;
  49627. $newState = null;
  49628. $expected = null;
  49629. $errStr = null;
  49630. while (true) {
  49631. $state = $this->stack[\count($this->stack)-1];
  49632. if (isset($this->defaultActions[$state])) {
  49633. $action = $this->defaultActions[$state];
  49634. } else {
  49635. if ($symbol == null) {
  49636. $symbol = $this->lex();
  49637. }
  49638. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  49639. }
  49640. if (!$action || !$action[0]) {
  49641. if (!$recovering) {
  49642. $expected = array();
  49643. foreach ($this->table[$state] as $p => $ignore) {
  49644. if (isset($this->terminals_[$p]) && $p > 2) {
  49645. $expected[] = "'" . $this->terminals_[$p] . "'";
  49646. }
  49647. }
  49648. $message = null;
  49649. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  49650. $message = "Invalid string";
  49651. if ("'" === substr($this->lexer->match, 0, 1)) {
  49652. $message .= ", it appears you used single quotes instead of double quotes";
  49653. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  49654. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  49655. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  49656. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  49657. }
  49658. }
  49659. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49660. $errStr .= $this->lexer->showPosition() . "\n";
  49661. if ($message) {
  49662. $errStr .= $message;
  49663. } else {
  49664. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  49665. $errStr .= implode(', ', $expected);
  49666. }
  49667. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  49668. $errStr .= " - It appears you have an extra trailing comma";
  49669. }
  49670. $this->parseError($errStr, array(
  49671. 'text' => $this->lexer->match,
  49672. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  49673. 'line' => $this->lexer->yylineno,
  49674. 'loc' => $yyloc,
  49675. 'expected' => $expected,
  49676. ));
  49677. }
  49678. if ($recovering == 3) {
  49679. if ($symbol == $EOF) {
  49680. throw new ParsingException($errStr ?: 'Parsing halted.');
  49681. }
  49682. $yyleng = $this->lexer->yyleng;
  49683. $yytext = $this->lexer->yytext;
  49684. $yylineno = $this->lexer->yylineno;
  49685. $yyloc = $this->lexer->yylloc;
  49686. $symbol = $this->lex();
  49687. }
  49688. while (true) {
  49689. if (\array_key_exists($TERROR, $this->table[$state])) {
  49690. break;
  49691. }
  49692. if ($state == 0) {
  49693. throw new ParsingException($errStr ?: 'Parsing halted.');
  49694. }
  49695. $this->popStack(1);
  49696. $state = $this->stack[\count($this->stack)-1];
  49697. }
  49698. $preErrorSymbol = $symbol;
  49699. $symbol = $TERROR;
  49700. $state = $this->stack[\count($this->stack)-1];
  49701. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  49702. $recovering = 3;
  49703. }
  49704. if (\is_array($action[0]) && \count($action) > 1) {
  49705. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  49706. }
  49707. switch ($action[0]) {
  49708. case 1:
  49709. $this->stack[] = $symbol;
  49710. $this->vstack[] = $this->lexer->yytext;
  49711. $this->lstack[] = $this->lexer->yylloc;
  49712. $this->stack[] = $action[1];
  49713. $symbol = null;
  49714. if (!$preErrorSymbol) {
  49715. $yyleng = $this->lexer->yyleng;
  49716. $yytext = $this->lexer->yytext;
  49717. $yylineno = $this->lexer->yylineno;
  49718. $yyloc = $this->lexer->yylloc;
  49719. if ($recovering > 0) {
  49720. $recovering--;
  49721. }
  49722. } else {
  49723. $symbol = $preErrorSymbol;
  49724. $preErrorSymbol = null;
  49725. }
  49726. break;
  49727. case 2:
  49728. $len = $this->productions_[$action[1]][1];
  49729. $yyval->token = $this->vstack[\count($this->vstack) - $len];
  49730. $yyval->store = array(
  49731. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  49732. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  49733. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  49734. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  49735. );
  49736. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack);
  49737. if (!$r instanceof Undefined) {
  49738. return $r;
  49739. }
  49740. if ($len) {
  49741. $this->popStack($len);
  49742. }
  49743. $this->stack[] = $this->productions_[$action[1]][0];
  49744. $this->vstack[] = $yyval->token;
  49745. $this->lstack[] = $yyval->store;
  49746. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  49747. $this->stack[] = $newState;
  49748. break;
  49749. case 3:
  49750. return true;
  49751. }
  49752. }
  49753. }
  49754. protected function parseError($str, $hash)
  49755. {
  49756. throw new ParsingException($str, $hash);
  49757. }
  49758. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  49759. {
  49760. $len = \count($tokens) - 1;
  49761. switch ($yystate) {
  49762. case 1:
  49763. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  49764. $yyval->token = $yytext;
  49765. break;
  49766. case 2:
  49767. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  49768. $yyval->token = \floatval($yytext);
  49769. } else {
  49770. $yyval->token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  49771. }
  49772. break;
  49773. case 3:
  49774. $yyval->token = null;
  49775. break;
  49776. case 4:
  49777. $yyval->token = true;
  49778. break;
  49779. case 5:
  49780. $yyval->token = false;
  49781. break;
  49782. case 6:
  49783. return $yyval->token = $tokens[$len-1];
  49784. case 13:
  49785. if ($this->flags & self::PARSE_TO_ASSOC) {
  49786. $yyval->token = array();
  49787. } else {
  49788. $yyval->token = new stdClass;
  49789. }
  49790. break;
  49791. case 14:
  49792. $yyval->token = $tokens[$len-1];
  49793. break;
  49794. case 15:
  49795. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  49796. break;
  49797. case 16:
  49798. if (PHP_VERSION_ID < 70100) {
  49799. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49800. } else {
  49801. $property = $tokens[$len][0];
  49802. }
  49803. if ($this->flags & self::PARSE_TO_ASSOC) {
  49804. $yyval->token = array();
  49805. $yyval->token[$property] = $tokens[$len][1];
  49806. } else {
  49807. $yyval->token = new stdClass;
  49808. $yyval->token->$property = $tokens[$len][1];
  49809. }
  49810. break;
  49811. case 17:
  49812. if ($this->flags & self::PARSE_TO_ASSOC) {
  49813. $yyval->token =& $tokens[$len-2];
  49814. $key = $tokens[$len][0];
  49815. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  49816. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49817. $errStr .= $this->lexer->showPosition() . "\n";
  49818. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49819. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49820. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  49821. $duplicateCount = 1;
  49822. do {
  49823. $duplicateKey = $key . '.' . $duplicateCount++;
  49824. } while (isset($tokens[$len-2][$duplicateKey]));
  49825. $key = $duplicateKey;
  49826. }
  49827. $tokens[$len-2][$key] = $tokens[$len][1];
  49828. } else {
  49829. $yyval->token = $tokens[$len-2];
  49830. if (PHP_VERSION_ID < 70100) {
  49831. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49832. } else {
  49833. $key = $tokens[$len][0];
  49834. }
  49835. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  49836. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49837. $errStr .= $this->lexer->showPosition() . "\n";
  49838. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49839. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49840. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  49841. $duplicateCount = 1;
  49842. do {
  49843. $duplicateKey = $key . '.' . $duplicateCount++;
  49844. } while (isset($tokens[$len-2]->$duplicateKey));
  49845. $key = $duplicateKey;
  49846. }
  49847. $tokens[$len-2]->$key = $tokens[$len][1];
  49848. }
  49849. break;
  49850. case 18:
  49851. $yyval->token = array();
  49852. break;
  49853. case 19:
  49854. $yyval->token = $tokens[$len-1];
  49855. break;
  49856. case 20:
  49857. $yyval->token = array($tokens[$len]);
  49858. break;
  49859. case 21:
  49860. $tokens[$len-2][] = $tokens[$len];
  49861. $yyval->token = $tokens[$len-2];
  49862. break;
  49863. }
  49864. return new Undefined();
  49865. }
  49866. private function stringInterpolation($match)
  49867. {
  49868. switch ($match[0]) {
  49869. case '\\\\':
  49870. return '\\';
  49871. case '\"':
  49872. return '"';
  49873. case '\b':
  49874. return \chr(8);
  49875. case '\f':
  49876. return \chr(12);
  49877. case '\n':
  49878. return "\n";
  49879. case '\r':
  49880. return "\r";
  49881. case '\t':
  49882. return "\t";
  49883. case '\/':
  49884. return "/";
  49885. default:
  49886. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  49887. }
  49888. }
  49889. private function popStack($n)
  49890. {
  49891. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  49892. $this->vstack = \array_slice($this->vstack, 0, - $n);
  49893. $this->lstack = \array_slice($this->lstack, 0, - $n);
  49894. }
  49895. private function lex()
  49896. {
  49897. $token = $this->lexer->lex() ?: 1;
  49898. if (!is_numeric($token)) {
  49899. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  49900. }
  49901. return $token;
  49902. }
  49903. private function failOnBOM($input)
  49904. {
  49905. $bom = "\xEF\xBB\xBF";
  49906. if (substr($input, 0, 3) === $bom) {
  49907. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  49908. }
  49909. }
  49910. }
  49911. <?php
  49912. namespace Seld\JsonLint;
  49913. class Lexer
  49914. {
  49915. private $EOF = 1;
  49916. private $rules = array(
  49917. 0 => '/\G\s+/',
  49918. 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  49919. 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  49920. 3 => '/\G\{/',
  49921. 4 => '/\G\}/',
  49922. 5 => '/\G\[/',
  49923. 6 => '/\G\]/',
  49924. 7 => '/\G,/',
  49925. 8 => '/\G:/',
  49926. 9 => '/\Gtrue\b/',
  49927. 10 => '/\Gfalse\b/',
  49928. 11 => '/\Gnull\b/',
  49929. 12 => '/\G$/',
  49930. 13 => '/\G./',
  49931. );
  49932. private $conditions = array(
  49933. "INITIAL" => array(
  49934. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  49935. "inclusive" => true,
  49936. ),
  49937. );
  49938. private $conditionStack;
  49939. private $input;
  49940. private $more;
  49941. private $done;
  49942. private $offset;
  49943. public $match;
  49944. public $yylineno;
  49945. public $yyleng;
  49946. public $yytext;
  49947. public $yylloc;
  49948. public function lex()
  49949. {
  49950. $r = $this->next();
  49951. if (!$r instanceof Undefined) {
  49952. return $r;
  49953. }
  49954. return $this->lex();
  49955. }
  49956. public function setInput($input)
  49957. {
  49958. $this->input = $input;
  49959. $this->more = false;
  49960. $this->done = false;
  49961. $this->offset = 0;
  49962. $this->yylineno = $this->yyleng = 0;
  49963. $this->yytext = $this->match = '';
  49964. $this->conditionStack = array('INITIAL');
  49965. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  49966. return $this;
  49967. }
  49968. public function showPosition()
  49969. {
  49970. $pre = str_replace("\n", '', $this->getPastInput());
  49971. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  49972. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  49973. }
  49974. public function getPastInput()
  49975. {
  49976. $pastLength = $this->offset - \strlen($this->match);
  49977. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  49978. }
  49979. public function getUpcomingInput()
  49980. {
  49981. $next = $this->match;
  49982. if (\strlen($next) < 20) {
  49983. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49984. }
  49985. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  49986. }
  49987. public function getFullUpcomingInput()
  49988. {
  49989. $next = $this->match;
  49990. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  49991. $len = \strlen($this->input);
  49992. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  49993. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  49994. } elseif (\strlen($next) < 20) {
  49995. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49996. }
  49997. return $next;
  49998. }
  49999. protected function parseError($str, $hash)
  50000. {
  50001. throw new \Exception($str);
  50002. }
  50003. private function next()
  50004. {
  50005. if ($this->done) {
  50006. return $this->EOF;
  50007. }
  50008. if ($this->offset === \strlen($this->input)) {
  50009. $this->done = true;
  50010. }
  50011. $token = null;
  50012. $match = null;
  50013. $col = null;
  50014. $lines = null;
  50015. if (!$this->more) {
  50016. $this->yytext = '';
  50017. $this->match = '';
  50018. }
  50019. $rules = $this->getCurrentRules();
  50020. $rulesLen = \count($rules);
  50021. for ($i=0; $i < $rulesLen; $i++) {
  50022. if (preg_match($this->rules[$rules[$i]], $this->input, $match, 0, $this->offset)) {
  50023. preg_match_all('/\n.*/', $match[0], $lines);
  50024. $lines = $lines[0];
  50025. if ($lines) {
  50026. $this->yylineno += \count($lines);
  50027. }
  50028. $this->yylloc = array(
  50029. 'first_line' => $this->yylloc['last_line'],
  50030. 'last_line' => $this->yylineno+1,
  50031. 'first_column' => $this->yylloc['last_column'],
  50032. 'last_column' => $lines ? \strlen($lines[\count($lines) - 1]) - 1 : $this->yylloc['last_column'] + \strlen($match[0]),
  50033. );
  50034. $this->yytext .= $match[0];
  50035. $this->match .= $match[0];
  50036. $this->yyleng = \strlen($this->yytext);
  50037. $this->more = false;
  50038. $this->offset += \strlen($match[0]);
  50039. $token = $this->performAction($rules[$i], $this->conditionStack[\count($this->conditionStack)-1]);
  50040. if ($token) {
  50041. return $token;
  50042. }
  50043. return new Undefined();
  50044. }
  50045. }
  50046. if ($this->offset === \strlen($this->input)) {
  50047. return $this->EOF;
  50048. }
  50049. $this->parseError(
  50050. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  50051. array(
  50052. 'text' => "",
  50053. 'token' => null,
  50054. 'line' => $this->yylineno,
  50055. )
  50056. );
  50057. }
  50058. private function getCurrentRules()
  50059. {
  50060. return $this->conditions[$this->conditionStack[\count($this->conditionStack)-1]]['rules'];
  50061. }
  50062. private function performAction($avoiding_name_collisions, $YY_START)
  50063. {
  50064. switch ($avoiding_name_collisions) {
  50065. case 0:
  50066. break;
  50067. case 1:
  50068. return 6;
  50069. case 2:
  50070. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  50071. return 4;
  50072. case 3:
  50073. return 17;
  50074. case 4:
  50075. return 18;
  50076. case 5:
  50077. return 23;
  50078. case 6:
  50079. return 24;
  50080. case 7:
  50081. return 22;
  50082. case 8:
  50083. return 21;
  50084. case 9:
  50085. return 10;
  50086. case 10:
  50087. return 11;
  50088. case 11:
  50089. return 8;
  50090. case 12:
  50091. return 14;
  50092. case 13:
  50093. return 'INVALID';
  50094. }
  50095. }
  50096. }
  50097. <?php
  50098. namespace Seld\JsonLint;
  50099. class ParsingException extends \Exception
  50100. {
  50101. protected $details;
  50102. public function __construct($message, $details = array())
  50103. {
  50104. $this->details = $details;
  50105. parent::__construct($message);
  50106. }
  50107. public function getDetails()
  50108. {
  50109. return $this->details;
  50110. }
  50111. }
  50112. <?php
  50113. namespace Seld\JsonLint;
  50114. class Undefined
  50115. {
  50116. }
  50117. MIT License
  50118. Copyright (c) 2016
  50119. Permission is hereby granted, free of charge, to any person obtaining a copy
  50120. of this software and associated documentation files (the "Software"), to deal
  50121. in the Software without restriction, including without limitation the rights
  50122. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50123. copies of the Software, and to permit persons to whom the Software is
  50124. furnished to do so, subject to the following conditions:
  50125. The above copyright notice and this permission notice shall be included in all
  50126. copies or substantial portions of the Software.
  50127. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50128. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50129. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50130. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50131. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50132. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50133. SOFTWARE.
  50134. <?php
  50135. require __DIR__ . '/../vendor/autoload.php';
  50136. $data = json_decode(file_get_contents('data.json'));
  50137. $validator = new JsonSchema\Validator();
  50138. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  50139. if ($validator->isValid()) {
  50140. echo "The supplied JSON validates against the schema.\n";
  50141. } else {
  50142. echo "JSON does not validate. Violations:\n";
  50143. foreach ($validator->getErrors() as $error) {
  50144. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  50145. }
  50146. }
  50147. <?php
  50148. namespace JsonSchema\Constraints;
  50149. use JsonSchema\Entity\JsonPointer;
  50150. use JsonSchema\Exception\InvalidArgumentException;
  50151. use JsonSchema\Exception\ValidationException;
  50152. use JsonSchema\Validator;
  50153. class BaseConstraint
  50154. {
  50155. protected $errors = array();
  50156. protected $errorMask = Validator::ERROR_NONE;
  50157. protected $factory;
  50158. public function __construct(Factory $factory = null)
  50159. {
  50160. $this->factory = $factory ?: new Factory();
  50161. }
  50162. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  50163. {
  50164. $error = array(
  50165. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  50166. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  50167. 'message' => $message,
  50168. 'constraint' => $constraint,
  50169. 'context' => $this->factory->getErrorContext(),
  50170. );
  50171. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  50172. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  50173. }
  50174. if (is_array($more) && count($more) > 0) {
  50175. $error += $more;
  50176. }
  50177. $this->errors[] = $error;
  50178. $this->errorMask |= $error['context'];
  50179. }
  50180. public function addErrors(array $errors)
  50181. {
  50182. if ($errors) {
  50183. $this->errors = array_merge($this->errors, $errors);
  50184. $errorMask = &$this->errorMask;
  50185. array_walk($errors, function ($error) use (&$errorMask) {
  50186. if (isset($error['context'])) {
  50187. $errorMask |= $error['context'];
  50188. }
  50189. });
  50190. }
  50191. }
  50192. public function getErrors($errorContext = Validator::ERROR_ALL)
  50193. {
  50194. if ($errorContext === Validator::ERROR_ALL) {
  50195. return $this->errors;
  50196. }
  50197. return array_filter($this->errors, function ($error) use ($errorContext) {
  50198. if ($errorContext & $error['context']) {
  50199. return true;
  50200. }
  50201. });
  50202. }
  50203. public function numErrors($errorContext = Validator::ERROR_ALL)
  50204. {
  50205. if ($errorContext === Validator::ERROR_ALL) {
  50206. return count($this->errors);
  50207. }
  50208. return count($this->getErrors($errorContext));
  50209. }
  50210. public function isValid()
  50211. {
  50212. return !$this->getErrors();
  50213. }
  50214. public function reset()
  50215. {
  50216. $this->errors = array();
  50217. $this->errorMask = Validator::ERROR_NONE;
  50218. }
  50219. public function getErrorMask()
  50220. {
  50221. return $this->errorMask;
  50222. }
  50223. public static function arrayToObjectRecursive($array)
  50224. {
  50225. $json = json_encode($array);
  50226. if (json_last_error() !== \JSON_ERROR_NONE) {
  50227. $message = 'Unable to encode schema array as JSON';
  50228. if (function_exists('json_last_error_msg')) {
  50229. $message .= ': ' . json_last_error_msg();
  50230. }
  50231. throw new InvalidArgumentException($message);
  50232. }
  50233. return (object) json_decode($json);
  50234. }
  50235. }
  50236. <?php
  50237. namespace JsonSchema\Constraints;
  50238. use JsonSchema\Entity\JsonPointer;
  50239. class CollectionConstraint extends Constraint
  50240. {
  50241. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50242. {
  50243. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  50244. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  50245. }
  50246. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  50247. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  50248. }
  50249. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  50250. $unique = $value;
  50251. if (is_array($value) && count($value)) {
  50252. $unique = array_map(function ($e) {
  50253. return var_export($e, true);
  50254. }, $value);
  50255. }
  50256. if (count(array_unique($unique)) != count($value)) {
  50257. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  50258. }
  50259. }
  50260. if (isset($schema->items)) {
  50261. $this->validateItems($value, $schema, $path, $i);
  50262. }
  50263. }
  50264. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50265. {
  50266. if (is_object($schema->items)) {
  50267. foreach ($value as $k => &$v) {
  50268. $initErrors = $this->getErrors();
  50269. $this->checkUndefined($v, $schema->items, $path, $k);
  50270. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  50271. $secondErrors = $this->getErrors();
  50272. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50273. }
  50274. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  50275. $this->errors = $secondErrors;
  50276. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  50277. $this->errors = $initErrors;
  50278. }
  50279. }
  50280. unset($v);
  50281. } else {
  50282. foreach ($value as $k => &$v) {
  50283. if (array_key_exists($k, $schema->items)) {
  50284. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  50285. } else {
  50286. if (property_exists($schema, 'additionalItems')) {
  50287. if ($schema->additionalItems !== false) {
  50288. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50289. } else {
  50290. $this->addError(
  50291. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  50292. }
  50293. } else {
  50294. $this->checkUndefined($v, new \stdClass(), $path, $k);
  50295. }
  50296. }
  50297. }
  50298. unset($v);
  50299. if (count($value) > 0) {
  50300. for ($k = count($value); $k < count($schema->items); $k++) {
  50301. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  50302. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  50303. }
  50304. }
  50305. }
  50306. }
  50307. }
  50308. <?php
  50309. namespace JsonSchema\Constraints;
  50310. use JsonSchema\Entity\JsonPointer;
  50311. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  50312. {
  50313. protected $inlineSchemaProperty = '$schema';
  50314. const CHECK_MODE_NONE = 0x00000000;
  50315. const CHECK_MODE_NORMAL = 0x00000001;
  50316. const CHECK_MODE_TYPE_CAST = 0x00000002;
  50317. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  50318. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  50319. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  50320. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  50321. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  50322. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  50323. protected function incrementPath(JsonPointer $path = null, $i)
  50324. {
  50325. $path = $path ?: new JsonPointer('');
  50326. $path = $path->withPropertyPaths(
  50327. array_merge(
  50328. $path->getPropertyPaths(),
  50329. array_filter(array($i), 'strlen')
  50330. )
  50331. );
  50332. return $path;
  50333. }
  50334. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50335. {
  50336. $validator = $this->factory->createInstanceFor('collection');
  50337. $validator->check($value, $schema, $path, $i);
  50338. $this->addErrors($validator->getErrors());
  50339. }
  50340. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  50341. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  50342. {
  50343. $validator = $this->factory->createInstanceFor('object');
  50344. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  50345. $this->addErrors($validator->getErrors());
  50346. }
  50347. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50348. {
  50349. $validator = $this->factory->createInstanceFor('type');
  50350. $validator->check($value, $schema, $path, $i);
  50351. $this->addErrors($validator->getErrors());
  50352. }
  50353. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  50354. {
  50355. $validator = $this->factory->createInstanceFor('undefined');
  50356. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  50357. $this->addErrors($validator->getErrors());
  50358. }
  50359. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  50360. {
  50361. $validator = $this->factory->createInstanceFor('string');
  50362. $validator->check($value, $schema, $path, $i);
  50363. $this->addErrors($validator->getErrors());
  50364. }
  50365. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  50366. {
  50367. $validator = $this->factory->createInstanceFor('number');
  50368. $validator->check($value, $schema, $path, $i);
  50369. $this->addErrors($validator->getErrors());
  50370. }
  50371. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  50372. {
  50373. $validator = $this->factory->createInstanceFor('enum');
  50374. $validator->check($value, $schema, $path, $i);
  50375. $this->addErrors($validator->getErrors());
  50376. }
  50377. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  50378. {
  50379. $validator = $this->factory->createInstanceFor('format');
  50380. $validator->check($value, $schema, $path, $i);
  50381. $this->addErrors($validator->getErrors());
  50382. }
  50383. protected function getTypeCheck()
  50384. {
  50385. return $this->factory->getTypeCheck();
  50386. }
  50387. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  50388. {
  50389. $result = array_map(
  50390. function ($path) {
  50391. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  50392. },
  50393. $pointer->getPropertyPaths()
  50394. );
  50395. return trim(implode('', $result), '.');
  50396. }
  50397. }
  50398. <?php
  50399. namespace JsonSchema\Constraints;
  50400. use JsonSchema\Entity\JsonPointer;
  50401. interface ConstraintInterface
  50402. {
  50403. public function getErrors();
  50404. public function addErrors(array $errors);
  50405. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  50406. public function isValid();
  50407. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  50408. }
  50409. <?php
  50410. namespace JsonSchema\Constraints;
  50411. use JsonSchema\Entity\JsonPointer;
  50412. class EnumConstraint extends Constraint
  50413. {
  50414. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50415. {
  50416. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  50417. return;
  50418. }
  50419. $type = gettype($element);
  50420. foreach ($schema->enum as $enum) {
  50421. $enumType = gettype($enum);
  50422. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  50423. if ((object) $element == $enum) {
  50424. return;
  50425. }
  50426. }
  50427. if ($type === gettype($enum)) {
  50428. if ($type == 'object') {
  50429. if ($element == $enum) {
  50430. return;
  50431. }
  50432. } elseif ($element === $enum) {
  50433. return;
  50434. }
  50435. }
  50436. }
  50437. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  50438. }
  50439. }
  50440. <?php
  50441. namespace JsonSchema\Constraints;
  50442. use JsonSchema\Exception\InvalidArgumentException;
  50443. use JsonSchema\SchemaStorage;
  50444. use JsonSchema\SchemaStorageInterface;
  50445. use JsonSchema\Uri\UriRetriever;
  50446. use JsonSchema\UriRetrieverInterface;
  50447. use JsonSchema\Validator;
  50448. class Factory
  50449. {
  50450. protected $schemaStorage;
  50451. protected $uriRetriever;
  50452. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  50453. private $typeCheck = array();
  50454. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  50455. protected $constraintMap = array(
  50456. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  50457. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  50458. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  50459. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  50460. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  50461. 'string' => 'JsonSchema\Constraints\StringConstraint',
  50462. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  50463. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  50464. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  50465. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  50466. 'validator' => 'JsonSchema\Validator'
  50467. );
  50468. private $instanceCache = array();
  50469. public function __construct(
  50470. SchemaStorageInterface $schemaStorage = null,
  50471. UriRetrieverInterface $uriRetriever = null,
  50472. $checkMode = Constraint::CHECK_MODE_NORMAL
  50473. ) {
  50474. $this->setConfig($checkMode);
  50475. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  50476. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  50477. }
  50478. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  50479. {
  50480. $this->checkMode = $checkMode;
  50481. }
  50482. public function addConfig($options)
  50483. {
  50484. $this->checkMode |= $options;
  50485. }
  50486. public function removeConfig($options)
  50487. {
  50488. $this->checkMode &= ~$options;
  50489. }
  50490. public function getConfig($options = null)
  50491. {
  50492. if ($options === null) {
  50493. return $this->checkMode;
  50494. }
  50495. return $this->checkMode & $options;
  50496. }
  50497. public function getUriRetriever()
  50498. {
  50499. return $this->uriRetriever;
  50500. }
  50501. public function getSchemaStorage()
  50502. {
  50503. return $this->schemaStorage;
  50504. }
  50505. public function getTypeCheck()
  50506. {
  50507. if (!isset($this->typeCheck[$this->checkMode])) {
  50508. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  50509. ? new TypeCheck\LooseTypeCheck()
  50510. : new TypeCheck\StrictTypeCheck();
  50511. }
  50512. return $this->typeCheck[$this->checkMode];
  50513. }
  50514. public function setConstraintClass($name, $class)
  50515. {
  50516. if (!class_exists($class)) {
  50517. throw new InvalidArgumentException('Unknown constraint ' . $name);
  50518. }
  50519. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  50520. throw new InvalidArgumentException('Invalid class ' . $name);
  50521. }
  50522. $this->constraintMap[$name] = $class;
  50523. return $this;
  50524. }
  50525. public function createInstanceFor($constraintName)
  50526. {
  50527. if (!isset($this->constraintMap[$constraintName])) {
  50528. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  50529. }
  50530. if (!isset($this->instanceCache[$constraintName])) {
  50531. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  50532. }
  50533. return clone $this->instanceCache[$constraintName];
  50534. }
  50535. public function getErrorContext()
  50536. {
  50537. return $this->errorContext;
  50538. }
  50539. public function setErrorContext($errorContext)
  50540. {
  50541. $this->errorContext = $errorContext;
  50542. }
  50543. }
  50544. <?php
  50545. namespace JsonSchema\Constraints;
  50546. use JsonSchema\Entity\JsonPointer;
  50547. use JsonSchema\Rfc3339;
  50548. class FormatConstraint extends Constraint
  50549. {
  50550. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50551. {
  50552. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  50553. return;
  50554. }
  50555. switch ($schema->format) {
  50556. case 'date':
  50557. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  50558. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  50559. }
  50560. break;
  50561. case 'time':
  50562. if (!$this->validateDateTime($element, 'H:i:s')) {
  50563. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  50564. }
  50565. break;
  50566. case 'date-time':
  50567. if (null === Rfc3339::createFromString($element)) {
  50568. $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));
  50569. }
  50570. break;
  50571. case 'utc-millisec':
  50572. if (!$this->validateDateTime($element, 'U')) {
  50573. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  50574. }
  50575. break;
  50576. case 'regex':
  50577. if (!$this->validateRegex($element)) {
  50578. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  50579. }
  50580. break;
  50581. case 'color':
  50582. if (!$this->validateColor($element)) {
  50583. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  50584. }
  50585. break;
  50586. case 'style':
  50587. if (!$this->validateStyle($element)) {
  50588. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  50589. }
  50590. break;
  50591. case 'phone':
  50592. if (!$this->validatePhone($element)) {
  50593. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  50594. }
  50595. break;
  50596. case 'uri':
  50597. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50598. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50599. }
  50600. break;
  50601. case 'uriref':
  50602. case 'uri-reference':
  50603. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50604. if (substr($element, 0, 2) === '//') {
  50605. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50606. } elseif (substr($element, 0, 1) === '/') {
  50607. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50608. } elseif (strlen($element)) {
  50609. $pathParts = explode('/', $element, 2);
  50610. if (strpos($pathParts[0], ':') !== false) {
  50611. $validURL = null;
  50612. } else {
  50613. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50614. }
  50615. } else {
  50616. $validURL = null;
  50617. }
  50618. if ($validURL === null) {
  50619. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50620. }
  50621. }
  50622. break;
  50623. case 'email':
  50624. $filterFlags = FILTER_NULL_ON_FAILURE;
  50625. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  50626. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  50627. }
  50628. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  50629. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  50630. }
  50631. break;
  50632. case 'ip-address':
  50633. case 'ipv4':
  50634. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  50635. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50636. }
  50637. break;
  50638. case 'ipv6':
  50639. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  50640. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50641. }
  50642. break;
  50643. case 'host-name':
  50644. case 'hostname':
  50645. if (!$this->validateHostname($element)) {
  50646. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  50647. }
  50648. break;
  50649. default:
  50650. break;
  50651. }
  50652. }
  50653. protected function validateDateTime($datetime, $format)
  50654. {
  50655. $dt = \DateTime::createFromFormat($format, $datetime);
  50656. if (!$dt) {
  50657. return false;
  50658. }
  50659. if ($datetime === $dt->format($format)) {
  50660. return true;
  50661. }
  50662. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  50663. return true;
  50664. }
  50665. return false;
  50666. }
  50667. protected function validateRegex($regex)
  50668. {
  50669. return false !== @preg_match('/' . $regex . '/u', '');
  50670. }
  50671. protected function validateColor($color)
  50672. {
  50673. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  50674. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  50675. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  50676. return true;
  50677. }
  50678. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  50679. }
  50680. protected function validateStyle($style)
  50681. {
  50682. $properties = explode(';', rtrim($style, ';'));
  50683. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  50684. return empty($invalidEntries);
  50685. }
  50686. protected function validatePhone($phone)
  50687. {
  50688. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  50689. }
  50690. protected function validateHostname($host)
  50691. {
  50692. $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';
  50693. return preg_match($hostnameRegex, $host);
  50694. }
  50695. }
  50696. <?php
  50697. namespace JsonSchema\Constraints;
  50698. use JsonSchema\Entity\JsonPointer;
  50699. class NumberConstraint extends Constraint
  50700. {
  50701. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50702. {
  50703. if (isset($schema->exclusiveMinimum)) {
  50704. if (isset($schema->minimum)) {
  50705. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  50706. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  50707. } elseif ($element < $schema->minimum) {
  50708. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50709. }
  50710. } else {
  50711. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  50712. }
  50713. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  50714. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50715. }
  50716. if (isset($schema->exclusiveMaximum)) {
  50717. if (isset($schema->maximum)) {
  50718. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  50719. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  50720. } elseif ($element > $schema->maximum) {
  50721. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50722. }
  50723. } else {
  50724. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  50725. }
  50726. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  50727. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50728. }
  50729. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  50730. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  50731. }
  50732. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  50733. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  50734. }
  50735. $this->checkFormat($element, $schema, $path, $i);
  50736. }
  50737. private function fmod($number1, $number2)
  50738. {
  50739. $modulus = ($number1 - round($number1 / $number2) * $number2);
  50740. $precision = 0.0000000001;
  50741. if (-$precision < $modulus && $modulus < $precision) {
  50742. return 0.0;
  50743. }
  50744. return $modulus;
  50745. }
  50746. }
  50747. <?php
  50748. namespace JsonSchema\Constraints;
  50749. use JsonSchema\Entity\JsonPointer;
  50750. class ObjectConstraint extends Constraint
  50751. {
  50752. protected $appliedDefaults = array();
  50753. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  50754. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  50755. {
  50756. if ($element instanceof UndefinedConstraint) {
  50757. return;
  50758. }
  50759. $this->appliedDefaults = $appliedDefaults;
  50760. $matches = array();
  50761. if ($patternProperties) {
  50762. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  50763. }
  50764. if ($properties) {
  50765. $this->validateProperties($element, $properties, $path);
  50766. }
  50767. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  50768. }
  50769. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  50770. {
  50771. $try = array('/', '#', '+', '~', '%');
  50772. $matches = array();
  50773. foreach ($patternProperties as $pregex => $schema) {
  50774. $delimiter = '/';
  50775. foreach ($try as $delimiter) {
  50776. if (strpos($pregex, $delimiter) === false) {
  50777. break;
  50778. }
  50779. }
  50780. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  50781. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  50782. continue;
  50783. }
  50784. foreach ($element as $i => $value) {
  50785. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  50786. $matches[] = $i;
  50787. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  50788. }
  50789. }
  50790. }
  50791. return $matches;
  50792. }
  50793. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  50794. $properties = null, $additionalProp = null)
  50795. {
  50796. $this->validateMinMaxConstraint($element, $schema, $path);
  50797. foreach ($element as $i => $value) {
  50798. $definition = $this->getProperty($properties, $i);
  50799. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  50800. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  50801. }
  50802. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  50803. if ($additionalProp === true) {
  50804. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  50805. } else {
  50806. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  50807. }
  50808. }
  50809. $require = $this->getProperty($definition, 'requires');
  50810. if ($require && !$this->getProperty($element, $require)) {
  50811. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  50812. }
  50813. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  50814. if (is_object($property)) {
  50815. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  50816. }
  50817. }
  50818. }
  50819. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  50820. {
  50821. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  50822. foreach ($properties as $i => $value) {
  50823. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  50824. $definition = $this->getProperty($properties, $i);
  50825. if (is_object($definition)) {
  50826. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  50827. }
  50828. }
  50829. }
  50830. protected function &getProperty(&$element, $property, $fallback = null)
  50831. {
  50832. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  50833. return $element[$property];
  50834. } elseif (is_object($element) && property_exists($element, $property)) {
  50835. return $element->$property;
  50836. }
  50837. return $fallback;
  50838. }
  50839. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  50840. {
  50841. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  50842. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  50843. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  50844. }
  50845. }
  50846. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  50847. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  50848. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  50849. }
  50850. }
  50851. }
  50852. }
  50853. <?php
  50854. namespace JsonSchema\Constraints;
  50855. use JsonSchema\Entity\JsonPointer;
  50856. use JsonSchema\Exception\InvalidArgumentException;
  50857. use JsonSchema\Exception\InvalidSchemaException;
  50858. use JsonSchema\Exception\RuntimeException;
  50859. use JsonSchema\Validator;
  50860. class SchemaConstraint extends Constraint
  50861. {
  50862. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  50863. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50864. {
  50865. if ($schema !== null) {
  50866. $validationSchema = $schema;
  50867. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  50868. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  50869. } else {
  50870. throw new InvalidArgumentException('no schema found to verify against');
  50871. }
  50872. if (is_array($validationSchema)) {
  50873. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  50874. }
  50875. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  50876. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  50877. throw new RuntimeException('Cannot validate the schema of a non-object');
  50878. }
  50879. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  50880. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  50881. } else {
  50882. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  50883. }
  50884. $schemaStorage = $this->factory->getSchemaStorage();
  50885. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  50886. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  50887. }
  50888. $initialErrorCount = $this->numErrors();
  50889. $initialConfig = $this->factory->getConfig();
  50890. $initialContext = $this->factory->getErrorContext();
  50891. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  50892. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  50893. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  50894. try {
  50895. $this->check($validationSchema, $schemaSpec);
  50896. } catch (\Exception $e) {
  50897. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  50898. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  50899. }
  50900. }
  50901. if ($this->numErrors() > $initialErrorCount) {
  50902. $this->addError($path, 'Schema is not valid', 'schema');
  50903. }
  50904. $this->factory->setConfig($initialConfig);
  50905. $this->factory->setErrorContext($initialContext);
  50906. }
  50907. $this->checkUndefined($element, $validationSchema, $path, $i);
  50908. }
  50909. }
  50910. <?php
  50911. namespace JsonSchema\Constraints;
  50912. use JsonSchema\Entity\JsonPointer;
  50913. class StringConstraint extends Constraint
  50914. {
  50915. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50916. {
  50917. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  50918. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  50919. 'maxLength' => $schema->maxLength,
  50920. ));
  50921. }
  50922. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  50923. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  50924. 'minLength' => $schema->minLength,
  50925. ));
  50926. }
  50927. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  50928. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  50929. 'pattern' => $schema->pattern,
  50930. ));
  50931. }
  50932. $this->checkFormat($element, $schema, $path, $i);
  50933. }
  50934. private function strlen($string)
  50935. {
  50936. if (extension_loaded('mbstring')) {
  50937. return mb_strlen($string, mb_detect_encoding($string));
  50938. }
  50939. return strlen($string);
  50940. }
  50941. }
  50942. <?php
  50943. namespace JsonSchema\Constraints\TypeCheck;
  50944. class LooseTypeCheck implements TypeCheckInterface
  50945. {
  50946. public static function isObject($value)
  50947. {
  50948. return
  50949. is_object($value) ||
  50950. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  50951. }
  50952. public static function isArray($value)
  50953. {
  50954. return
  50955. is_array($value) &&
  50956. (count($value) == 0 || !self::isAssociativeArray($value));
  50957. }
  50958. public static function propertyGet($value, $property)
  50959. {
  50960. if (is_object($value)) {
  50961. return $value->{$property};
  50962. }
  50963. return $value[$property];
  50964. }
  50965. public static function propertySet(&$value, $property, $data)
  50966. {
  50967. if (is_object($value)) {
  50968. $value->{$property} = $data;
  50969. } else {
  50970. $value[$property] = $data;
  50971. }
  50972. }
  50973. public static function propertyExists($value, $property)
  50974. {
  50975. if (is_object($value)) {
  50976. return property_exists($value, $property);
  50977. }
  50978. return array_key_exists($property, $value);
  50979. }
  50980. public static function propertyCount($value)
  50981. {
  50982. if (is_object($value)) {
  50983. return count(get_object_vars($value));
  50984. }
  50985. return count($value);
  50986. }
  50987. private static function isAssociativeArray($arr)
  50988. {
  50989. return array_keys($arr) !== range(0, count($arr) - 1);
  50990. }
  50991. }
  50992. <?php
  50993. namespace JsonSchema\Constraints\TypeCheck;
  50994. class StrictTypeCheck implements TypeCheckInterface
  50995. {
  50996. public static function isObject($value)
  50997. {
  50998. return is_object($value);
  50999. }
  51000. public static function isArray($value)
  51001. {
  51002. return is_array($value);
  51003. }
  51004. public static function propertyGet($value, $property)
  51005. {
  51006. return $value->{$property};
  51007. }
  51008. public static function propertySet(&$value, $property, $data)
  51009. {
  51010. $value->{$property} = $data;
  51011. }
  51012. public static function propertyExists($value, $property)
  51013. {
  51014. return property_exists($value, $property);
  51015. }
  51016. public static function propertyCount($value)
  51017. {
  51018. if (!is_object($value)) {
  51019. return 0;
  51020. }
  51021. return count(get_object_vars($value));
  51022. }
  51023. }
  51024. <?php
  51025. namespace JsonSchema\Constraints\TypeCheck;
  51026. interface TypeCheckInterface
  51027. {
  51028. public static function isObject($value);
  51029. public static function isArray($value);
  51030. public static function propertyGet($value, $property);
  51031. public static function propertySet(&$value, $property, $data);
  51032. public static function propertyExists($value, $property);
  51033. public static function propertyCount($value);
  51034. }
  51035. <?php
  51036. namespace JsonSchema\Constraints;
  51037. use JsonSchema\Entity\JsonPointer;
  51038. use JsonSchema\Exception\InvalidArgumentException;
  51039. use UnexpectedValueException as StandardUnexpectedValueException;
  51040. class TypeConstraint extends Constraint
  51041. {
  51042. public static $wording = array(
  51043. 'integer' => 'an integer',
  51044. 'number' => 'a number',
  51045. 'boolean' => 'a boolean',
  51046. 'object' => 'an object',
  51047. 'array' => 'an array',
  51048. 'string' => 'a string',
  51049. 'null' => 'a null',
  51050. 'any' => null,
  51051. 0 => null,
  51052. );
  51053. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  51054. {
  51055. $type = isset($schema->type) ? $schema->type : null;
  51056. $isValid = false;
  51057. $wording = array();
  51058. if (is_array($type)) {
  51059. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  51060. } elseif (is_object($type)) {
  51061. $this->checkUndefined($value, $type, $path);
  51062. return;
  51063. } else {
  51064. $isValid = $this->validateType($value, $type);
  51065. }
  51066. if ($isValid === false) {
  51067. if (!is_array($type)) {
  51068. $this->validateTypeNameWording($type);
  51069. $wording[] = self::$wording[$type];
  51070. }
  51071. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  51072. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  51073. }
  51074. }
  51075. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  51076. {
  51077. foreach ($type as $tp) {
  51078. if (is_object($tp)) {
  51079. if (!$isValid) {
  51080. $validator = $this->factory->createInstanceFor('type');
  51081. $subSchema = new \stdClass();
  51082. $subSchema->type = $tp;
  51083. $validator->check($value, $subSchema, $path, null);
  51084. $error = $validator->getErrors();
  51085. $isValid = !(bool) $error;
  51086. $validTypesWording[] = self::$wording['object'];
  51087. }
  51088. } else {
  51089. $this->validateTypeNameWording($tp);
  51090. $validTypesWording[] = self::$wording[$tp];
  51091. if (!$isValid) {
  51092. $isValid = $this->validateType($value, $tp);
  51093. }
  51094. }
  51095. }
  51096. }
  51097. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  51098. {
  51099. if ($listEnd === false || !isset($elements[1])) {
  51100. return implode($delimiter, $elements);
  51101. }
  51102. $lastElement = array_slice($elements, -1);
  51103. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  51104. $implodedElements = array_merge(array($firsElements), $lastElement);
  51105. return join(" $listEnd ", $implodedElements);
  51106. }
  51107. protected function validateTypeNameWording($type)
  51108. {
  51109. if (!isset(self::$wording[$type])) {
  51110. throw new StandardUnexpectedValueException(
  51111. sprintf(
  51112. 'No wording for %s available, expected wordings are: [%s]',
  51113. var_export($type, true),
  51114. implode(', ', array_filter(self::$wording)))
  51115. );
  51116. }
  51117. }
  51118. protected function validateType(&$value, $type)
  51119. {
  51120. if (!$type) {
  51121. return true;
  51122. }
  51123. if ('any' === $type) {
  51124. return true;
  51125. }
  51126. if ('object' === $type) {
  51127. return $this->getTypeCheck()->isObject($value);
  51128. }
  51129. if ('array' === $type) {
  51130. return $this->getTypeCheck()->isArray($value);
  51131. }
  51132. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  51133. if ('integer' === $type) {
  51134. if ($coerce) {
  51135. $value = $this->toInteger($value);
  51136. }
  51137. return is_int($value);
  51138. }
  51139. if ('number' === $type) {
  51140. if ($coerce) {
  51141. $value = $this->toNumber($value);
  51142. }
  51143. return is_numeric($value) && !is_string($value);
  51144. }
  51145. if ('boolean' === $type) {
  51146. if ($coerce) {
  51147. $value = $this->toBoolean($value);
  51148. }
  51149. return is_bool($value);
  51150. }
  51151. if ('string' === $type) {
  51152. return is_string($value);
  51153. }
  51154. if ('email' === $type) {
  51155. return is_string($value);
  51156. }
  51157. if ('null' === $type) {
  51158. return is_null($value);
  51159. }
  51160. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  51161. }
  51162. protected function toBoolean($value)
  51163. {
  51164. if ($value === 'true') {
  51165. return true;
  51166. }
  51167. if ($value === 'false') {
  51168. return false;
  51169. }
  51170. return $value;
  51171. }
  51172. protected function toNumber($value)
  51173. {
  51174. if (is_numeric($value)) {
  51175. return $value + 0;
  51176. }
  51177. return $value;
  51178. }
  51179. protected function toInteger($value)
  51180. {
  51181. if (is_numeric($value) && (int) $value == $value) {
  51182. return (int) $value;
  51183. }
  51184. return $value;
  51185. }
  51186. }
  51187. <?php
  51188. namespace JsonSchema\Constraints;
  51189. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  51190. use JsonSchema\Entity\JsonPointer;
  51191. use JsonSchema\Exception\ValidationException;
  51192. use JsonSchema\Uri\UriResolver;
  51193. class UndefinedConstraint extends Constraint
  51194. {
  51195. protected $appliedDefaults = array();
  51196. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  51197. {
  51198. if (is_null($schema) || !is_object($schema)) {
  51199. return;
  51200. }
  51201. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  51202. if ($fromDefault) {
  51203. $path->setFromDefault();
  51204. }
  51205. $this->validateCommonProperties($value, $schema, $path, $i);
  51206. $this->validateOfProperties($value, $schema, $path, '');
  51207. $this->validateTypes($value, $schema, $path, $i);
  51208. }
  51209. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  51210. {
  51211. if ($this->getTypeCheck()->isArray($value)) {
  51212. $this->checkArray($value, $schema, $path, $i);
  51213. }
  51214. if (LooseTypeCheck::isObject($value)) {
  51215. $this->checkObject(
  51216. $value,
  51217. $schema,
  51218. $path,
  51219. isset($schema->properties) ? $schema->properties : null,
  51220. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  51221. isset($schema->patternProperties) ? $schema->patternProperties : null,
  51222. $this->appliedDefaults
  51223. );
  51224. }
  51225. if (is_string($value)) {
  51226. $this->checkString($value, $schema, $path, $i);
  51227. }
  51228. if (is_numeric($value)) {
  51229. $this->checkNumber($value, $schema, $path, $i);
  51230. }
  51231. if (isset($schema->enum)) {
  51232. $this->checkEnum($value, $schema, $path, $i);
  51233. }
  51234. }
  51235. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  51236. {
  51237. if (isset($schema->extends)) {
  51238. if (is_string($schema->extends)) {
  51239. $schema->extends = $this->validateUri($schema, $schema->extends);
  51240. }
  51241. if (is_array($schema->extends)) {
  51242. foreach ($schema->extends as $extends) {
  51243. $this->checkUndefined($value, $extends, $path, $i);
  51244. }
  51245. } else {
  51246. $this->checkUndefined($value, $schema->extends, $path, $i);
  51247. }
  51248. }
  51249. if (!$path->fromDefault()) {
  51250. $this->applyDefaultValues($value, $schema, $path);
  51251. }
  51252. if ($this->getTypeCheck()->isObject($value)) {
  51253. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  51254. foreach ($schema->required as $required) {
  51255. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  51256. $this->addError(
  51257. $this->incrementPath($path ?: new JsonPointer(''), $required),
  51258. 'The property ' . $required . ' is required',
  51259. 'required'
  51260. );
  51261. }
  51262. }
  51263. } elseif (isset($schema->required) && !is_array($schema->required)) {
  51264. if ($schema->required && $value instanceof self) {
  51265. $propertyPaths = $path->getPropertyPaths();
  51266. $propertyName = end($propertyPaths);
  51267. $this->addError(
  51268. $path,
  51269. 'The property ' . $propertyName . ' is required',
  51270. 'required'
  51271. );
  51272. }
  51273. } else {
  51274. if ($value instanceof self) {
  51275. return;
  51276. }
  51277. }
  51278. }
  51279. if (!($value instanceof self)) {
  51280. $this->checkType($value, $schema, $path, $i);
  51281. }
  51282. if (isset($schema->disallow)) {
  51283. $initErrors = $this->getErrors();
  51284. $typeSchema = new \stdClass();
  51285. $typeSchema->type = $schema->disallow;
  51286. $this->checkType($value, $typeSchema, $path);
  51287. if (count($this->getErrors()) == count($initErrors)) {
  51288. $this->addError($path, 'Disallowed value was matched', 'disallow');
  51289. } else {
  51290. $this->errors = $initErrors;
  51291. }
  51292. }
  51293. if (isset($schema->not)) {
  51294. $initErrors = $this->getErrors();
  51295. $this->checkUndefined($value, $schema->not, $path, $i);
  51296. if (count($this->getErrors()) == count($initErrors)) {
  51297. $this->addError($path, 'Matched a schema which it should not', 'not');
  51298. } else {
  51299. $this->errors = $initErrors;
  51300. }
  51301. }
  51302. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  51303. $this->validateDependencies($value, $schema->dependencies, $path);
  51304. }
  51305. }
  51306. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  51307. {
  51308. if (!$requiredOnly) {
  51309. return true;
  51310. }
  51311. if (
  51312. $name !== null
  51313. && isset($parentSchema->required)
  51314. && is_array($parentSchema->required)
  51315. && in_array($name, $parentSchema->required)
  51316. ) {
  51317. return true;
  51318. }
  51319. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  51320. return true;
  51321. }
  51322. return false;
  51323. }
  51324. protected function applyDefaultValues(&$value, $schema, $path)
  51325. {
  51326. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  51327. return;
  51328. }
  51329. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  51330. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  51331. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  51332. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  51333. if (
  51334. !LooseTypeCheck::propertyExists($value, $currentProperty)
  51335. && property_exists($propertyDefinition, 'default')
  51336. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  51337. ) {
  51338. if (is_object($propertyDefinition->default)) {
  51339. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  51340. } else {
  51341. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  51342. }
  51343. $this->appliedDefaults[] = $currentProperty;
  51344. }
  51345. }
  51346. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  51347. $items = array();
  51348. if (LooseTypeCheck::isArray($schema->items)) {
  51349. $items = $schema->items;
  51350. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  51351. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  51352. }
  51353. foreach ($items as $currentItem => $itemDefinition) {
  51354. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  51355. if (
  51356. !array_key_exists($currentItem, $value)
  51357. && property_exists($itemDefinition, 'default')
  51358. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  51359. if (is_object($itemDefinition->default)) {
  51360. $value[$currentItem] = clone $itemDefinition->default;
  51361. } else {
  51362. $value[$currentItem] = $itemDefinition->default;
  51363. }
  51364. }
  51365. $path->setFromDefault();
  51366. }
  51367. } elseif (
  51368. $value instanceof self
  51369. && property_exists($schema, 'default')
  51370. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  51371. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  51372. $path->setFromDefault();
  51373. }
  51374. }
  51375. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  51376. {
  51377. if ($value instanceof self) {
  51378. return;
  51379. }
  51380. if (isset($schema->allOf)) {
  51381. $isValid = true;
  51382. foreach ($schema->allOf as $allOf) {
  51383. $initErrors = $this->getErrors();
  51384. $this->checkUndefined($value, $allOf, $path, $i);
  51385. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  51386. }
  51387. if (!$isValid) {
  51388. $this->addError($path, 'Failed to match all schemas', 'allOf');
  51389. }
  51390. }
  51391. if (isset($schema->anyOf)) {
  51392. $isValid = false;
  51393. $startErrors = $this->getErrors();
  51394. $caughtException = null;
  51395. foreach ($schema->anyOf as $anyOf) {
  51396. $initErrors = $this->getErrors();
  51397. try {
  51398. $this->checkUndefined($value, $anyOf, $path, $i);
  51399. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  51400. break;
  51401. }
  51402. } catch (ValidationException $e) {
  51403. $isValid = false;
  51404. }
  51405. }
  51406. if (!$isValid) {
  51407. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  51408. } else {
  51409. $this->errors = $startErrors;
  51410. }
  51411. }
  51412. if (isset($schema->oneOf)) {
  51413. $allErrors = array();
  51414. $matchedSchemas = 0;
  51415. $startErrors = $this->getErrors();
  51416. foreach ($schema->oneOf as $oneOf) {
  51417. try {
  51418. $this->errors = array();
  51419. $this->checkUndefined($value, $oneOf, $path, $i);
  51420. if (count($this->getErrors()) == 0) {
  51421. $matchedSchemas++;
  51422. }
  51423. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  51424. } catch (ValidationException $e) {
  51425. }
  51426. }
  51427. if ($matchedSchemas !== 1) {
  51428. $this->addErrors(array_merge($allErrors, $startErrors));
  51429. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  51430. } else {
  51431. $this->errors = $startErrors;
  51432. }
  51433. }
  51434. }
  51435. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  51436. {
  51437. foreach ($dependencies as $key => $dependency) {
  51438. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  51439. if (is_string($dependency)) {
  51440. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  51441. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  51442. }
  51443. } elseif (is_array($dependency)) {
  51444. foreach ($dependency as $d) {
  51445. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  51446. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  51447. }
  51448. }
  51449. } elseif (is_object($dependency)) {
  51450. $this->checkUndefined($value, $dependency, $path, $i);
  51451. }
  51452. }
  51453. }
  51454. }
  51455. protected function validateUri($schema, $schemaUri = null)
  51456. {
  51457. $resolver = new UriResolver();
  51458. $retriever = $this->factory->getUriRetriever();
  51459. $jsonSchema = null;
  51460. if ($resolver->isValid($schemaUri)) {
  51461. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  51462. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  51463. }
  51464. return $jsonSchema;
  51465. }
  51466. }
  51467. <?php
  51468. namespace JsonSchema\Entity;
  51469. use JsonSchema\Exception\InvalidArgumentException;
  51470. class JsonPointer
  51471. {
  51472. private $filename;
  51473. private $propertyPaths = array();
  51474. private $fromDefault = false;
  51475. public function __construct($value)
  51476. {
  51477. if (!is_string($value)) {
  51478. throw new InvalidArgumentException('Ref value must be a string');
  51479. }
  51480. $splitRef = explode('#', $value, 2);
  51481. $this->filename = $splitRef[0];
  51482. if (array_key_exists(1, $splitRef)) {
  51483. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  51484. }
  51485. }
  51486. private function decodePropertyPaths($propertyPathString)
  51487. {
  51488. $paths = array();
  51489. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  51490. $path = $this->decodePath($path);
  51491. if (is_string($path) && '' !== $path) {
  51492. $paths[] = $path;
  51493. }
  51494. }
  51495. return $paths;
  51496. }
  51497. private function encodePropertyPaths()
  51498. {
  51499. return array_map(
  51500. array($this, 'encodePath'),
  51501. $this->getPropertyPaths()
  51502. );
  51503. }
  51504. private function decodePath($path)
  51505. {
  51506. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  51507. }
  51508. private function encodePath($path)
  51509. {
  51510. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  51511. }
  51512. public function getFilename()
  51513. {
  51514. return $this->filename;
  51515. }
  51516. public function getPropertyPaths()
  51517. {
  51518. return $this->propertyPaths;
  51519. }
  51520. public function withPropertyPaths(array $propertyPaths)
  51521. {
  51522. $new = clone $this;
  51523. $new->propertyPaths = $propertyPaths;
  51524. return $new;
  51525. }
  51526. public function getPropertyPathAsString()
  51527. {
  51528. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  51529. }
  51530. public function __toString()
  51531. {
  51532. return $this->getFilename() . $this->getPropertyPathAsString();
  51533. }
  51534. public function setFromDefault()
  51535. {
  51536. $this->fromDefault = true;
  51537. }
  51538. public function fromDefault()
  51539. {
  51540. return $this->fromDefault;
  51541. }
  51542. }
  51543. <?php
  51544. namespace JsonSchema\Exception;
  51545. interface ExceptionInterface
  51546. {
  51547. }
  51548. <?php
  51549. namespace JsonSchema\Exception;
  51550. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  51551. {
  51552. }
  51553. <?php
  51554. namespace JsonSchema\Exception;
  51555. class InvalidConfigException extends RuntimeException
  51556. {
  51557. }
  51558. <?php
  51559. namespace JsonSchema\Exception;
  51560. class InvalidSchemaException extends RuntimeException
  51561. {
  51562. }
  51563. <?php
  51564. namespace JsonSchema\Exception;
  51565. class InvalidSchemaMediaTypeException extends RuntimeException
  51566. {
  51567. }
  51568. <?php
  51569. namespace JsonSchema\Exception;
  51570. class InvalidSourceUriException extends InvalidArgumentException
  51571. {
  51572. }
  51573. <?php
  51574. namespace JsonSchema\Exception;
  51575. class JsonDecodingException extends RuntimeException
  51576. {
  51577. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  51578. {
  51579. switch ($code) {
  51580. case JSON_ERROR_DEPTH:
  51581. $message = 'The maximum stack depth has been exceeded';
  51582. break;
  51583. case JSON_ERROR_STATE_MISMATCH:
  51584. $message = 'Invalid or malformed JSON';
  51585. break;
  51586. case JSON_ERROR_CTRL_CHAR:
  51587. $message = 'Control character error, possibly incorrectly encoded';
  51588. break;
  51589. case JSON_ERROR_UTF8:
  51590. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  51591. break;
  51592. case JSON_ERROR_SYNTAX:
  51593. $message = 'JSON syntax is malformed';
  51594. break;
  51595. default:
  51596. $message = 'Syntax error';
  51597. }
  51598. parent::__construct($message, $code, $previous);
  51599. }
  51600. }
  51601. <?php
  51602. namespace JsonSchema\Exception;
  51603. class ResourceNotFoundException extends RuntimeException
  51604. {
  51605. }
  51606. <?php
  51607. namespace JsonSchema\Exception;
  51608. class RuntimeException extends \RuntimeException implements ExceptionInterface
  51609. {
  51610. }
  51611. <?php
  51612. namespace JsonSchema\Exception;
  51613. class UnresolvableJsonPointerException extends InvalidArgumentException
  51614. {
  51615. }
  51616. <?php
  51617. namespace JsonSchema\Exception;
  51618. class UriResolverException extends RuntimeException
  51619. {
  51620. }
  51621. <?php
  51622. namespace JsonSchema\Exception;
  51623. class ValidationException extends RuntimeException
  51624. {
  51625. }
  51626. <?php
  51627. namespace JsonSchema\Iterator;
  51628. class ObjectIterator implements \Iterator, \Countable
  51629. {
  51630. private $object;
  51631. private $position = 0;
  51632. private $data = array();
  51633. private $initialized = false;
  51634. public function __construct($object)
  51635. {
  51636. $this->object = $object;
  51637. }
  51638. public function current()
  51639. {
  51640. $this->initialize();
  51641. return $this->data[$this->position];
  51642. }
  51643. public function next()
  51644. {
  51645. $this->initialize();
  51646. $this->position++;
  51647. }
  51648. public function key()
  51649. {
  51650. $this->initialize();
  51651. return $this->position;
  51652. }
  51653. public function valid()
  51654. {
  51655. $this->initialize();
  51656. return isset($this->data[$this->position]);
  51657. }
  51658. public function rewind()
  51659. {
  51660. $this->initialize();
  51661. $this->position = 0;
  51662. }
  51663. public function count()
  51664. {
  51665. $this->initialize();
  51666. return count($this->data);
  51667. }
  51668. private function initialize()
  51669. {
  51670. if (!$this->initialized) {
  51671. $this->data = $this->buildDataFromObject($this->object);
  51672. $this->initialized = true;
  51673. }
  51674. }
  51675. private function buildDataFromObject($object)
  51676. {
  51677. $result = array();
  51678. $stack = new \SplStack();
  51679. $stack->push($object);
  51680. while (!$stack->isEmpty()) {
  51681. $current = $stack->pop();
  51682. if (is_object($current)) {
  51683. array_push($result, $current);
  51684. }
  51685. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  51686. if (is_object($propertyValue) || is_array($propertyValue)) {
  51687. $stack->push($propertyValue);
  51688. }
  51689. }
  51690. }
  51691. return $result;
  51692. }
  51693. private function getDataFromItem($item)
  51694. {
  51695. if (!is_object($item) && !is_array($item)) {
  51696. return array();
  51697. }
  51698. return is_object($item) ? get_object_vars($item) : $item;
  51699. }
  51700. }
  51701. <?php
  51702. namespace JsonSchema;
  51703. class Rfc3339
  51704. {
  51705. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  51706. public static function createFromString($string)
  51707. {
  51708. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  51709. return null;
  51710. }
  51711. $dateAndTime = $matches[1];
  51712. $microseconds = $matches[2] ?: '.000000';
  51713. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  51714. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  51715. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  51716. return $dateTime ?: null;
  51717. }
  51718. }
  51719. <?php
  51720. namespace JsonSchema;
  51721. use JsonSchema\Constraints\BaseConstraint;
  51722. use JsonSchema\Entity\JsonPointer;
  51723. use JsonSchema\Exception\UnresolvableJsonPointerException;
  51724. use JsonSchema\Uri\UriResolver;
  51725. use JsonSchema\Uri\UriRetriever;
  51726. class SchemaStorage implements SchemaStorageInterface
  51727. {
  51728. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  51729. protected $uriRetriever;
  51730. protected $uriResolver;
  51731. protected $schemas = array();
  51732. public function __construct(
  51733. UriRetrieverInterface $uriRetriever = null,
  51734. UriResolverInterface $uriResolver = null
  51735. ) {
  51736. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  51737. $this->uriResolver = $uriResolver ?: new UriResolver();
  51738. }
  51739. public function getUriRetriever()
  51740. {
  51741. return $this->uriRetriever;
  51742. }
  51743. public function getUriResolver()
  51744. {
  51745. return $this->uriResolver;
  51746. }
  51747. public function addSchema($id, $schema = null)
  51748. {
  51749. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  51750. $schema = $this->uriRetriever->retrieve($id);
  51751. }
  51752. if (is_array($schema)) {
  51753. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  51754. }
  51755. if (is_object($schema) && property_exists($schema, 'id')) {
  51756. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  51757. $schema->properties->id->format = 'uri-reference';
  51758. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  51759. $schema->properties->id->format = 'uri-reference';
  51760. $schema->properties->{'$ref'}->format = 'uri-reference';
  51761. }
  51762. }
  51763. $this->expandRefs($schema, $id);
  51764. $this->schemas[$id] = $schema;
  51765. }
  51766. private function expandRefs(&$schema, $base = null)
  51767. {
  51768. if (!is_object($schema)) {
  51769. if (is_array($schema)) {
  51770. foreach ($schema as &$member) {
  51771. $this->expandRefs($member, $base);
  51772. }
  51773. }
  51774. return;
  51775. }
  51776. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  51777. $base = $this->uriResolver->resolve($schema->id, $base);
  51778. }
  51779. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  51780. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  51781. $schema->{'$ref'} = (string) $refPointer;
  51782. }
  51783. foreach ($schema as &$member) {
  51784. $this->expandRefs($member, $base);
  51785. }
  51786. }
  51787. public function getSchema($id)
  51788. {
  51789. if (!array_key_exists($id, $this->schemas)) {
  51790. $this->addSchema($id);
  51791. }
  51792. return $this->schemas[$id];
  51793. }
  51794. public function resolveRef($ref)
  51795. {
  51796. $jsonPointer = new JsonPointer($ref);
  51797. $fileName = $jsonPointer->getFilename();
  51798. if (!strlen($fileName)) {
  51799. throw new UnresolvableJsonPointerException(sprintf(
  51800. "Could not resolve fragment '%s': no file is defined",
  51801. $jsonPointer->getPropertyPathAsString()
  51802. ));
  51803. }
  51804. $refSchema = $this->getSchema($fileName);
  51805. foreach ($jsonPointer->getPropertyPaths() as $path) {
  51806. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  51807. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  51808. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  51809. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  51810. } else {
  51811. throw new UnresolvableJsonPointerException(sprintf(
  51812. 'File: %s is found, but could not resolve fragment: %s',
  51813. $jsonPointer->getFilename(),
  51814. $jsonPointer->getPropertyPathAsString()
  51815. ));
  51816. }
  51817. }
  51818. return $refSchema;
  51819. }
  51820. public function resolveRefSchema($refSchema)
  51821. {
  51822. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  51823. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  51824. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  51825. unset($refSchema->{'$ref'});
  51826. }
  51827. return $refSchema;
  51828. }
  51829. }
  51830. <?php
  51831. namespace JsonSchema;
  51832. interface SchemaStorageInterface
  51833. {
  51834. public function addSchema($id, $schema = null);
  51835. public function getSchema($id);
  51836. public function resolveRef($ref);
  51837. public function resolveRefSchema($refSchema);
  51838. }
  51839. <?php
  51840. namespace JsonSchema\Uri\Retrievers;
  51841. abstract class AbstractRetriever implements UriRetrieverInterface
  51842. {
  51843. protected $contentType;
  51844. public function getContentType()
  51845. {
  51846. return $this->contentType;
  51847. }
  51848. }
  51849. <?php
  51850. namespace JsonSchema\Uri\Retrievers;
  51851. use JsonSchema\Exception\RuntimeException;
  51852. use JsonSchema\Validator;
  51853. class Curl extends AbstractRetriever
  51854. {
  51855. protected $messageBody;
  51856. public function __construct()
  51857. {
  51858. if (!function_exists('curl_init')) {
  51859. throw new RuntimeException('cURL not installed');
  51860. }
  51861. }
  51862. public function retrieve($uri)
  51863. {
  51864. $ch = curl_init();
  51865. curl_setopt($ch, CURLOPT_URL, $uri);
  51866. curl_setopt($ch, CURLOPT_HEADER, true);
  51867. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  51868. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  51869. $response = curl_exec($ch);
  51870. if (false === $response) {
  51871. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  51872. }
  51873. $this->fetchMessageBody($response);
  51874. $this->fetchContentType($response);
  51875. curl_close($ch);
  51876. return $this->messageBody;
  51877. }
  51878. private function fetchMessageBody($response)
  51879. {
  51880. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  51881. $this->messageBody = $match[1];
  51882. }
  51883. protected function fetchContentType($response)
  51884. {
  51885. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  51886. $this->contentType = trim($match[1]);
  51887. return true;
  51888. }
  51889. return false;
  51890. }
  51891. }
  51892. <?php
  51893. namespace JsonSchema\Uri\Retrievers;
  51894. use JsonSchema\Exception\ResourceNotFoundException;
  51895. class FileGetContents extends AbstractRetriever
  51896. {
  51897. protected $messageBody;
  51898. public function retrieve($uri)
  51899. {
  51900. $errorMessage = null;
  51901. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  51902. $errorMessage = $errstr;
  51903. });
  51904. $response = file_get_contents($uri);
  51905. restore_error_handler();
  51906. if ($errorMessage) {
  51907. throw new ResourceNotFoundException($errorMessage);
  51908. }
  51909. if (false === $response) {
  51910. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51911. }
  51912. if ($response == ''
  51913. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  51914. ) {
  51915. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51916. }
  51917. $this->messageBody = $response;
  51918. if (!empty($http_response_header)) {
  51919. $this->fetchContentType($http_response_header);
  51920. } else {
  51921. $this->contentType = null;
  51922. }
  51923. return $this->messageBody;
  51924. }
  51925. private function fetchContentType(array $headers)
  51926. {
  51927. foreach ($headers as $header) {
  51928. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  51929. return true;
  51930. }
  51931. }
  51932. return false;
  51933. }
  51934. protected static function getContentTypeMatchInHeader($header)
  51935. {
  51936. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  51937. return trim($match[1]);
  51938. }
  51939. return null;
  51940. }
  51941. }
  51942. <?php
  51943. namespace JsonSchema\Uri\Retrievers;
  51944. use JsonSchema\Validator;
  51945. class PredefinedArray extends AbstractRetriever
  51946. {
  51947. private $schemas;
  51948. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  51949. {
  51950. $this->schemas = $schemas;
  51951. $this->contentType = $contentType;
  51952. }
  51953. public function retrieve($uri)
  51954. {
  51955. if (!array_key_exists($uri, $this->schemas)) {
  51956. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  51957. 'The JSON schema "%s" was not found.',
  51958. $uri
  51959. ));
  51960. }
  51961. return $this->schemas[$uri];
  51962. }
  51963. }
  51964. <?php
  51965. namespace JsonSchema\Uri\Retrievers;
  51966. interface UriRetrieverInterface
  51967. {
  51968. public function retrieve($uri);
  51969. public function getContentType();
  51970. }
  51971. <?php
  51972. namespace JsonSchema\Uri;
  51973. use JsonSchema\Exception\UriResolverException;
  51974. use JsonSchema\UriResolverInterface;
  51975. class UriResolver implements UriResolverInterface
  51976. {
  51977. public function parse($uri)
  51978. {
  51979. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  51980. $components = array();
  51981. if (5 < count($match)) {
  51982. $components = array(
  51983. 'scheme' => $match[2],
  51984. 'authority' => $match[4],
  51985. 'path' => $match[5]
  51986. );
  51987. }
  51988. if (7 < count($match)) {
  51989. $components['query'] = $match[7];
  51990. }
  51991. if (9 < count($match)) {
  51992. $components['fragment'] = $match[9];
  51993. }
  51994. return $components;
  51995. }
  51996. public function generate(array $components)
  51997. {
  51998. $uri = $components['scheme'] . '://'
  51999. . $components['authority']
  52000. . $components['path'];
  52001. if (array_key_exists('query', $components) && strlen($components['query'])) {
  52002. $uri .= '?' . $components['query'];
  52003. }
  52004. if (array_key_exists('fragment', $components)) {
  52005. $uri .= '#' . $components['fragment'];
  52006. }
  52007. return $uri;
  52008. }
  52009. public function resolve($uri, $baseUri = null)
  52010. {
  52011. if (
  52012. !is_null($baseUri) &&
  52013. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  52014. !preg_match('|^[^/]+://|u', $baseUri)
  52015. ) {
  52016. if (is_file($baseUri)) {
  52017. $baseUri = 'file://' . realpath($baseUri);
  52018. } elseif (is_dir($baseUri)) {
  52019. $baseUri = 'file://' . realpath($baseUri) . '/';
  52020. } else {
  52021. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  52022. }
  52023. }
  52024. if ($uri == '') {
  52025. return $baseUri;
  52026. }
  52027. $components = $this->parse($uri);
  52028. $path = $components['path'];
  52029. if (!empty($components['scheme'])) {
  52030. return $uri;
  52031. }
  52032. $baseComponents = $this->parse($baseUri);
  52033. $basePath = $baseComponents['path'];
  52034. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  52035. if (isset($components['fragment'])) {
  52036. $baseComponents['fragment'] = $components['fragment'];
  52037. }
  52038. return $this->generate($baseComponents);
  52039. }
  52040. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  52041. {
  52042. $relativePath = self::normalizePath($relativePath);
  52043. if ($relativePath == '') {
  52044. return $basePath;
  52045. }
  52046. if ($relativePath[0] == '/') {
  52047. return $relativePath;
  52048. }
  52049. $basePathSegments = explode('/', $basePath);
  52050. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  52051. $numLevelUp = strlen($match[0]) /3 + 1;
  52052. if ($numLevelUp >= count($basePathSegments)) {
  52053. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  52054. }
  52055. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  52056. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  52057. return implode('/', $basePathSegments) . '/' . $path;
  52058. }
  52059. private static function normalizePath($path)
  52060. {
  52061. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  52062. $path = preg_replace('|//|', '/', $path);
  52063. return $path;
  52064. }
  52065. public function isValid($uri)
  52066. {
  52067. $components = $this->parse($uri);
  52068. return !empty($components);
  52069. }
  52070. }
  52071. <?php
  52072. namespace JsonSchema\Uri;
  52073. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  52074. use JsonSchema\Exception\JsonDecodingException;
  52075. use JsonSchema\Exception\ResourceNotFoundException;
  52076. use JsonSchema\Uri\Retrievers\FileGetContents;
  52077. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  52078. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  52079. use JsonSchema\Validator;
  52080. class UriRetriever implements BaseUriRetrieverInterface
  52081. {
  52082. protected $translationMap = array(
  52083. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  52084. );
  52085. protected $allowedInvalidContentTypeEndpoints = array(
  52086. 'http://json-schema.org/',
  52087. 'https://json-schema.org/'
  52088. );
  52089. protected $uriRetriever = null;
  52090. private $schemaCache = array();
  52091. public function addInvalidContentTypeEndpoint($endpoint)
  52092. {
  52093. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  52094. }
  52095. public function confirmMediaType($uriRetriever, $uri)
  52096. {
  52097. $contentType = $uriRetriever->getContentType();
  52098. if (is_null($contentType)) {
  52099. return;
  52100. }
  52101. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  52102. return;
  52103. }
  52104. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  52105. if (strpos($uri, $endpoint) === 0) {
  52106. return true;
  52107. }
  52108. }
  52109. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  52110. }
  52111. public function getUriRetriever()
  52112. {
  52113. if (is_null($this->uriRetriever)) {
  52114. $this->setUriRetriever(new FileGetContents());
  52115. }
  52116. return $this->uriRetriever;
  52117. }
  52118. public function resolvePointer($jsonSchema, $uri)
  52119. {
  52120. $resolver = new UriResolver();
  52121. $parsed = $resolver->parse($uri);
  52122. if (empty($parsed['fragment'])) {
  52123. return $jsonSchema;
  52124. }
  52125. $path = explode('/', $parsed['fragment']);
  52126. while ($path) {
  52127. $pathElement = array_shift($path);
  52128. if (!empty($pathElement)) {
  52129. $pathElement = str_replace('~1', '/', $pathElement);
  52130. $pathElement = str_replace('~0', '~', $pathElement);
  52131. if (!empty($jsonSchema->$pathElement)) {
  52132. $jsonSchema = $jsonSchema->$pathElement;
  52133. } else {
  52134. throw new ResourceNotFoundException(
  52135. 'Fragment "' . $parsed['fragment'] . '" not found'
  52136. . ' in ' . $uri
  52137. );
  52138. }
  52139. if (!is_object($jsonSchema)) {
  52140. throw new ResourceNotFoundException(
  52141. 'Fragment part "' . $pathElement . '" is no object '
  52142. . ' in ' . $uri
  52143. );
  52144. }
  52145. }
  52146. }
  52147. return $jsonSchema;
  52148. }
  52149. public function retrieve($uri, $baseUri = null, $translate = true)
  52150. {
  52151. $resolver = new UriResolver();
  52152. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  52153. $arParts = $resolver->parse($resolvedUri);
  52154. if (isset($arParts['fragment'])) {
  52155. unset($arParts['fragment']);
  52156. $fetchUri = $resolver->generate($arParts);
  52157. }
  52158. if ($translate) {
  52159. $fetchUri = $this->translate($fetchUri);
  52160. }
  52161. $jsonSchema = $this->loadSchema($fetchUri);
  52162. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  52163. if ($jsonSchema instanceof \stdClass) {
  52164. $jsonSchema->id = $resolvedUri;
  52165. }
  52166. return $jsonSchema;
  52167. }
  52168. protected function loadSchema($fetchUri)
  52169. {
  52170. if (isset($this->schemaCache[$fetchUri])) {
  52171. return $this->schemaCache[$fetchUri];
  52172. }
  52173. $uriRetriever = $this->getUriRetriever();
  52174. $contents = $this->uriRetriever->retrieve($fetchUri);
  52175. $this->confirmMediaType($uriRetriever, $fetchUri);
  52176. $jsonSchema = json_decode($contents);
  52177. if (JSON_ERROR_NONE < $error = json_last_error()) {
  52178. throw new JsonDecodingException($error);
  52179. }
  52180. $this->schemaCache[$fetchUri] = $jsonSchema;
  52181. return $jsonSchema;
  52182. }
  52183. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  52184. {
  52185. $this->uriRetriever = $uriRetriever;
  52186. return $this;
  52187. }
  52188. public function parse($uri)
  52189. {
  52190. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  52191. $components = array();
  52192. if (5 < count($match)) {
  52193. $components = array(
  52194. 'scheme' => $match[2],
  52195. 'authority' => $match[4],
  52196. 'path' => $match[5]
  52197. );
  52198. }
  52199. if (7 < count($match)) {
  52200. $components['query'] = $match[7];
  52201. }
  52202. if (9 < count($match)) {
  52203. $components['fragment'] = $match[9];
  52204. }
  52205. return $components;
  52206. }
  52207. public function generate(array $components)
  52208. {
  52209. $uri = $components['scheme'] . '://'
  52210. . $components['authority']
  52211. . $components['path'];
  52212. if (array_key_exists('query', $components)) {
  52213. $uri .= $components['query'];
  52214. }
  52215. if (array_key_exists('fragment', $components)) {
  52216. $uri .= $components['fragment'];
  52217. }
  52218. return $uri;
  52219. }
  52220. public function resolve($uri, $baseUri = null)
  52221. {
  52222. $components = $this->parse($uri);
  52223. $path = $components['path'];
  52224. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  52225. return $uri;
  52226. }
  52227. $baseComponents = $this->parse($baseUri);
  52228. $basePath = $baseComponents['path'];
  52229. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  52230. return $this->generate($baseComponents);
  52231. }
  52232. public function isValid($uri)
  52233. {
  52234. $components = $this->parse($uri);
  52235. return !empty($components);
  52236. }
  52237. public function setTranslation($from, $to)
  52238. {
  52239. $this->translationMap[$from] = $to;
  52240. }
  52241. public function translate($uri)
  52242. {
  52243. foreach ($this->translationMap as $from => $to) {
  52244. $uri = preg_replace($from, $to, $uri);
  52245. }
  52246. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  52247. return $uri;
  52248. }
  52249. }
  52250. <?php
  52251. namespace JsonSchema;
  52252. interface UriResolverInterface
  52253. {
  52254. public function resolve($uri, $baseUri = null);
  52255. }
  52256. <?php
  52257. namespace JsonSchema;
  52258. interface UriRetrieverInterface
  52259. {
  52260. public function retrieve($uri, $baseUri = null);
  52261. }
  52262. <?php
  52263. namespace JsonSchema;
  52264. use JsonSchema\Constraints\BaseConstraint;
  52265. use JsonSchema\Constraints\Constraint;
  52266. class Validator extends BaseConstraint
  52267. {
  52268. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  52269. const ERROR_NONE = 0x00000000;
  52270. const ERROR_ALL = 0xFFFFFFFF;
  52271. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  52272. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  52273. public function validate(&$value, $schema = null, $checkMode = null)
  52274. {
  52275. if (is_array($schema)) {
  52276. $schema = self::arrayToObjectRecursive($schema);
  52277. }
  52278. $initialCheckMode = $this->factory->getConfig();
  52279. if ($checkMode !== null) {
  52280. $this->factory->setConfig($checkMode);
  52281. }
  52282. if (is_object($schema) && property_exists($schema, 'id')) {
  52283. $schemaURI = $schema->id;
  52284. } else {
  52285. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  52286. }
  52287. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  52288. $validator = $this->factory->createInstanceFor('schema');
  52289. $validator->check(
  52290. $value,
  52291. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  52292. );
  52293. $this->factory->setConfig($initialCheckMode);
  52294. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  52295. return $validator->getErrorMask();
  52296. }
  52297. public function check($value, $schema)
  52298. {
  52299. return $this->validate($value, $schema);
  52300. }
  52301. public function coerce(&$value, $schema)
  52302. {
  52303. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  52304. }
  52305. }
  52306. Copyright (C) 2015 Composer
  52307. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52308. this software and associated documentation files (the "Software"), to deal in
  52309. the Software without restriction, including without limitation the rights to
  52310. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52311. of the Software, and to permit persons to whom the Software is furnished to do
  52312. so, subject to the following conditions:
  52313. The above copyright notice and this permission notice shall be included in all
  52314. copies or substantial portions of the Software.
  52315. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52316. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52317. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52318. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52319. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52320. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52321. SOFTWARE.
  52322. <?php
  52323. namespace Composer\Spdx;
  52324. class SpdxLicenses
  52325. {
  52326. const LICENSES_FILE = 'spdx-licenses.json';
  52327. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  52328. private $licenses;
  52329. private $licensesExpression;
  52330. private $exceptions;
  52331. private $exceptionsExpression;
  52332. public function __construct()
  52333. {
  52334. $this->loadLicenses();
  52335. $this->loadExceptions();
  52336. }
  52337. public function getLicenseByIdentifier($identifier)
  52338. {
  52339. $key = strtolower($identifier);
  52340. if (!isset($this->licenses[$key])) {
  52341. return;
  52342. }
  52343. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  52344. return array(
  52345. $name,
  52346. $isOsiApproved,
  52347. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  52348. $isDeprecatedLicenseId,
  52349. );
  52350. }
  52351. public function getLicenses()
  52352. {
  52353. return $this->licenses;
  52354. }
  52355. public function getExceptionByIdentifier($identifier)
  52356. {
  52357. $key = strtolower($identifier);
  52358. if (!isset($this->exceptions[$key])) {
  52359. return;
  52360. }
  52361. list($identifier, $name) = $this->exceptions[$key];
  52362. return array(
  52363. $name,
  52364. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  52365. );
  52366. }
  52367. public function getIdentifierByName($name)
  52368. {
  52369. foreach ($this->licenses as $licenseData) {
  52370. if ($licenseData[1] === $name) {
  52371. return $licenseData[0];
  52372. }
  52373. }
  52374. foreach ($this->exceptions as $licenseData) {
  52375. if ($licenseData[1] === $name) {
  52376. return $licenseData[0];
  52377. }
  52378. }
  52379. }
  52380. public function isOsiApprovedByIdentifier($identifier)
  52381. {
  52382. return $this->licenses[strtolower($identifier)][2];
  52383. }
  52384. public function isDeprecatedByIdentifier($identifier)
  52385. {
  52386. return $this->licenses[strtolower($identifier)][3];
  52387. }
  52388. public function validate($license)
  52389. {
  52390. if (is_array($license)) {
  52391. $count = count($license);
  52392. if ($count !== count(array_filter($license, 'is_string'))) {
  52393. throw new \InvalidArgumentException('Array of strings expected.');
  52394. }
  52395. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  52396. }
  52397. if (!is_string($license)) {
  52398. throw new \InvalidArgumentException(sprintf(
  52399. 'Array or String expected, %s given.',
  52400. gettype($license)
  52401. ));
  52402. }
  52403. return $this->isValidLicenseString($license);
  52404. }
  52405. public static function getResourcesDir()
  52406. {
  52407. return dirname(__DIR__) . '/res';
  52408. }
  52409. private function loadLicenses()
  52410. {
  52411. if (null !== $this->licenses) {
  52412. return;
  52413. }
  52414. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  52415. $this->licenses = array();
  52416. foreach (json_decode($json, true) as $identifier => $license) {
  52417. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  52418. }
  52419. }
  52420. private function loadExceptions()
  52421. {
  52422. if (null !== $this->exceptions) {
  52423. return;
  52424. }
  52425. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  52426. $this->exceptions = array();
  52427. foreach (json_decode($json, true) as $identifier => $exception) {
  52428. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  52429. }
  52430. }
  52431. private function getLicensesExpression()
  52432. {
  52433. if (null === $this->licensesExpression) {
  52434. $licenses = array_map('preg_quote', array_keys($this->licenses));
  52435. rsort($licenses);
  52436. $licenses = implode('|', $licenses);
  52437. $this->licensesExpression = $licenses;
  52438. }
  52439. return $this->licensesExpression;
  52440. }
  52441. private function getExceptionsExpression()
  52442. {
  52443. if (null === $this->exceptionsExpression) {
  52444. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  52445. rsort($exceptions);
  52446. $exceptions = implode('|', $exceptions);
  52447. $this->exceptionsExpression = $exceptions;
  52448. }
  52449. return $this->exceptionsExpression;
  52450. }
  52451. private function isValidLicenseString($license)
  52452. {
  52453. if (isset($this->licenses[strtolower($license)])) {
  52454. return true;
  52455. }
  52456. $licenses = $this->getLicensesExpression();
  52457. $exceptions = $this->getExceptionsExpression();
  52458. $regex = <<<REGEX
  52459. {
  52460. (?(DEFINE)
  52461. # idstring: 1*( ALPHA / DIGIT / - / . )
  52462. (?<idstring>[\pL\pN.-]{1,})
  52463. # license-id: taken from list
  52464. (?<licenseid>${licenses})
  52465. # license-exception-id: taken from list
  52466. (?<licenseexceptionid>${exceptions})
  52467. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  52468. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  52469. # simple-expresssion: license-id / license-id+ / license-ref
  52470. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  52471. # compound-expression: 1*(
  52472. # simple-expression /
  52473. # simple-expression WITH license-exception-id /
  52474. # compound-expression AND compound-expression /
  52475. # compound-expression OR compound-expression
  52476. # ) / ( compound-expression ) )
  52477. (?<compound_head>
  52478. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  52479. | \( \s* (?&compound_expression) \s* \)
  52480. )
  52481. (?<compound_expression>
  52482. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  52483. )
  52484. # license-expression: 1*1(simple-expression / compound-expression)
  52485. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  52486. ) # end of define
  52487. ^(NONE | NOASSERTION | (?&license_expression))$
  52488. }xi
  52489. REGEX;
  52490. $match = preg_match($regex, $license);
  52491. if (0 === $match) {
  52492. return false;
  52493. }
  52494. if (false === $match) {
  52495. throw new \RuntimeException('Regex failed to compile/run.');
  52496. }
  52497. return true;
  52498. }
  52499. }
  52500. Copyright (C) 2015 Composer
  52501. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52502. this software and associated documentation files (the "Software"), to deal in
  52503. the Software without restriction, including without limitation the rights to
  52504. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52505. of the Software, and to permit persons to whom the Software is furnished to do
  52506. so, subject to the following conditions:
  52507. The above copyright notice and this permission notice shall be included in all
  52508. copies or substantial portions of the Software.
  52509. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52510. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52511. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52512. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52513. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52514. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52515. SOFTWARE.
  52516. <?php
  52517. namespace Composer\Semver;
  52518. use Composer\Semver\Constraint\Constraint;
  52519. class Comparator
  52520. {
  52521. public static function greaterThan($version1, $version2)
  52522. {
  52523. return self::compare($version1, '>', $version2);
  52524. }
  52525. public static function greaterThanOrEqualTo($version1, $version2)
  52526. {
  52527. return self::compare($version1, '>=', $version2);
  52528. }
  52529. public static function lessThan($version1, $version2)
  52530. {
  52531. return self::compare($version1, '<', $version2);
  52532. }
  52533. public static function lessThanOrEqualTo($version1, $version2)
  52534. {
  52535. return self::compare($version1, '<=', $version2);
  52536. }
  52537. public static function equalTo($version1, $version2)
  52538. {
  52539. return self::compare($version1, '==', $version2);
  52540. }
  52541. public static function notEqualTo($version1, $version2)
  52542. {
  52543. return self::compare($version1, '!=', $version2);
  52544. }
  52545. public static function compare($version1, $operator, $version2)
  52546. {
  52547. $constraint = new Constraint($operator, $version2);
  52548. return $constraint->matches(new Constraint('==', $version1));
  52549. }
  52550. }
  52551. <?php
  52552. namespace Composer\Semver\Constraint;
  52553. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  52554. abstract class AbstractConstraint implements ConstraintInterface
  52555. {
  52556. protected $prettyString;
  52557. public function matches(ConstraintInterface $provider)
  52558. {
  52559. if ($provider instanceof $this) {
  52560. return $this->matchSpecific($provider);
  52561. }
  52562. return $provider->matches($this);
  52563. }
  52564. public function setPrettyString($prettyString)
  52565. {
  52566. $this->prettyString = $prettyString;
  52567. }
  52568. public function getPrettyString()
  52569. {
  52570. if ($this->prettyString) {
  52571. return $this->prettyString;
  52572. }
  52573. return $this->__toString();
  52574. }
  52575. }
  52576. <?php
  52577. namespace Composer\Semver\Constraint;
  52578. class Constraint implements ConstraintInterface
  52579. {
  52580. const OP_EQ = 0;
  52581. const OP_LT = 1;
  52582. const OP_LE = 2;
  52583. const OP_GT = 3;
  52584. const OP_GE = 4;
  52585. const OP_NE = 5;
  52586. private static $transOpStr = array(
  52587. '=' => self::OP_EQ,
  52588. '==' => self::OP_EQ,
  52589. '<' => self::OP_LT,
  52590. '<=' => self::OP_LE,
  52591. '>' => self::OP_GT,
  52592. '>=' => self::OP_GE,
  52593. '<>' => self::OP_NE,
  52594. '!=' => self::OP_NE,
  52595. );
  52596. private static $transOpInt = array(
  52597. self::OP_EQ => '==',
  52598. self::OP_LT => '<',
  52599. self::OP_LE => '<=',
  52600. self::OP_GT => '>',
  52601. self::OP_GE => '>=',
  52602. self::OP_NE => '!=',
  52603. );
  52604. protected $operator;
  52605. protected $version;
  52606. protected $prettyString;
  52607. public function matches(ConstraintInterface $provider)
  52608. {
  52609. if ($provider instanceof $this) {
  52610. return $this->matchSpecific($provider);
  52611. }
  52612. return $provider->matches($this);
  52613. }
  52614. public function setPrettyString($prettyString)
  52615. {
  52616. $this->prettyString = $prettyString;
  52617. }
  52618. public function getPrettyString()
  52619. {
  52620. if ($this->prettyString) {
  52621. return $this->prettyString;
  52622. }
  52623. return $this->__toString();
  52624. }
  52625. public static function getSupportedOperators()
  52626. {
  52627. return array_keys(self::$transOpStr);
  52628. }
  52629. public function __construct($operator, $version)
  52630. {
  52631. if (!isset(self::$transOpStr[$operator])) {
  52632. throw new \InvalidArgumentException(sprintf(
  52633. 'Invalid operator "%s" given, expected one of: %s',
  52634. $operator,
  52635. implode(', ', self::getSupportedOperators())
  52636. ));
  52637. }
  52638. $this->operator = self::$transOpStr[$operator];
  52639. $this->version = $version;
  52640. }
  52641. public function versionCompare($a, $b, $operator, $compareBranches = false)
  52642. {
  52643. if (!isset(self::$transOpStr[$operator])) {
  52644. throw new \InvalidArgumentException(sprintf(
  52645. 'Invalid operator "%s" given, expected one of: %s',
  52646. $operator,
  52647. implode(', ', self::getSupportedOperators())
  52648. ));
  52649. }
  52650. $aIsBranch = 'dev-' === substr($a, 0, 4);
  52651. $bIsBranch = 'dev-' === substr($b, 0, 4);
  52652. if ($aIsBranch && $bIsBranch) {
  52653. return $operator === '==' && $a === $b;
  52654. }
  52655. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  52656. return false;
  52657. }
  52658. return version_compare($a, $b, $operator);
  52659. }
  52660. public function matchSpecific(Constraint $provider, $compareBranches = false)
  52661. {
  52662. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  52663. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  52664. $isEqualOp = self::OP_EQ === $this->operator;
  52665. $isNonEqualOp = self::OP_NE === $this->operator;
  52666. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  52667. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  52668. if ($isNonEqualOp || $isProviderNonEqualOp) {
  52669. return (!$isEqualOp && !$isProviderEqualOp)
  52670. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  52671. }
  52672. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  52673. return true;
  52674. }
  52675. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  52676. return !($provider->version === $this->version
  52677. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  52678. && self::$transOpInt[$this->operator] !== $noEqualOp);
  52679. }
  52680. return false;
  52681. }
  52682. public function __toString()
  52683. {
  52684. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  52685. }
  52686. }
  52687. <?php
  52688. namespace Composer\Semver\Constraint;
  52689. interface ConstraintInterface
  52690. {
  52691. public function matches(ConstraintInterface $provider);
  52692. public function getPrettyString();
  52693. public function __toString();
  52694. }
  52695. <?php
  52696. namespace Composer\Semver\Constraint;
  52697. class EmptyConstraint implements ConstraintInterface
  52698. {
  52699. protected $prettyString;
  52700. public function matches(ConstraintInterface $provider)
  52701. {
  52702. return true;
  52703. }
  52704. public function setPrettyString($prettyString)
  52705. {
  52706. $this->prettyString = $prettyString;
  52707. }
  52708. public function getPrettyString()
  52709. {
  52710. if ($this->prettyString) {
  52711. return $this->prettyString;
  52712. }
  52713. return (string) $this;
  52714. }
  52715. public function __toString()
  52716. {
  52717. return '[]';
  52718. }
  52719. }
  52720. <?php
  52721. namespace Composer\Semver\Constraint;
  52722. class MultiConstraint implements ConstraintInterface
  52723. {
  52724. protected $constraints;
  52725. protected $prettyString;
  52726. protected $conjunctive;
  52727. public function __construct(array $constraints, $conjunctive = true)
  52728. {
  52729. $this->constraints = $constraints;
  52730. $this->conjunctive = $conjunctive;
  52731. }
  52732. public function getConstraints()
  52733. {
  52734. return $this->constraints;
  52735. }
  52736. public function isConjunctive()
  52737. {
  52738. return $this->conjunctive;
  52739. }
  52740. public function isDisjunctive()
  52741. {
  52742. return !$this->conjunctive;
  52743. }
  52744. public function matches(ConstraintInterface $provider)
  52745. {
  52746. if (false === $this->conjunctive) {
  52747. foreach ($this->constraints as $constraint) {
  52748. if ($constraint->matches($provider)) {
  52749. return true;
  52750. }
  52751. }
  52752. return false;
  52753. }
  52754. foreach ($this->constraints as $constraint) {
  52755. if (!$constraint->matches($provider)) {
  52756. return false;
  52757. }
  52758. }
  52759. return true;
  52760. }
  52761. public function setPrettyString($prettyString)
  52762. {
  52763. $this->prettyString = $prettyString;
  52764. }
  52765. public function getPrettyString()
  52766. {
  52767. if ($this->prettyString) {
  52768. return $this->prettyString;
  52769. }
  52770. return (string) $this;
  52771. }
  52772. public function __toString()
  52773. {
  52774. $constraints = array();
  52775. foreach ($this->constraints as $constraint) {
  52776. $constraints[] = (string) $constraint;
  52777. }
  52778. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  52779. }
  52780. }
  52781. <?php
  52782. namespace Composer\Semver;
  52783. use Composer\Semver\Constraint\Constraint;
  52784. class Semver
  52785. {
  52786. const SORT_ASC = 1;
  52787. const SORT_DESC = -1;
  52788. private static $versionParser;
  52789. public static function satisfies($version, $constraints)
  52790. {
  52791. if (null === self::$versionParser) {
  52792. self::$versionParser = new VersionParser();
  52793. }
  52794. $versionParser = self::$versionParser;
  52795. $provider = new Constraint('==', $versionParser->normalize($version));
  52796. $parsedConstraints = $versionParser->parseConstraints($constraints);
  52797. return $parsedConstraints->matches($provider);
  52798. }
  52799. public static function satisfiedBy(array $versions, $constraints)
  52800. {
  52801. $versions = array_filter($versions, function ($version) use ($constraints) {
  52802. return Semver::satisfies($version, $constraints);
  52803. });
  52804. return array_values($versions);
  52805. }
  52806. public static function sort(array $versions)
  52807. {
  52808. return self::usort($versions, self::SORT_ASC);
  52809. }
  52810. public static function rsort(array $versions)
  52811. {
  52812. return self::usort($versions, self::SORT_DESC);
  52813. }
  52814. private static function usort(array $versions, $direction)
  52815. {
  52816. if (null === self::$versionParser) {
  52817. self::$versionParser = new VersionParser();
  52818. }
  52819. $versionParser = self::$versionParser;
  52820. $normalized = array();
  52821. foreach ($versions as $key => $version) {
  52822. $normalized[] = array($versionParser->normalize($version), $key);
  52823. }
  52824. usort($normalized, function (array $left, array $right) use ($direction) {
  52825. if ($left[0] === $right[0]) {
  52826. return 0;
  52827. }
  52828. if (Comparator::lessThan($left[0], $right[0])) {
  52829. return -$direction;
  52830. }
  52831. return $direction;
  52832. });
  52833. $sorted = array();
  52834. foreach ($normalized as $item) {
  52835. $sorted[] = $versions[$item[1]];
  52836. }
  52837. return $sorted;
  52838. }
  52839. }
  52840. <?php
  52841. namespace Composer\Semver;
  52842. use Composer\Semver\Constraint\ConstraintInterface;
  52843. use Composer\Semver\Constraint\EmptyConstraint;
  52844. use Composer\Semver\Constraint\MultiConstraint;
  52845. use Composer\Semver\Constraint\Constraint;
  52846. class VersionParser
  52847. {
  52848. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  52849. private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
  52850. public static function parseStability($version)
  52851. {
  52852. $version = preg_replace('{#.+$}i', '', $version);
  52853. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  52854. return 'dev';
  52855. }
  52856. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  52857. if (!empty($match[3])) {
  52858. return 'dev';
  52859. }
  52860. if (!empty($match[1])) {
  52861. if ('beta' === $match[1] || 'b' === $match[1]) {
  52862. return 'beta';
  52863. }
  52864. if ('alpha' === $match[1] || 'a' === $match[1]) {
  52865. return 'alpha';
  52866. }
  52867. if ('rc' === $match[1]) {
  52868. return 'RC';
  52869. }
  52870. }
  52871. return 'stable';
  52872. }
  52873. public static function normalizeStability($stability)
  52874. {
  52875. $stability = strtolower($stability);
  52876. return $stability === 'rc' ? 'RC' : $stability;
  52877. }
  52878. public function normalize($version, $fullVersion = null)
  52879. {
  52880. $version = trim($version);
  52881. $origVersion = $version;
  52882. if (null === $fullVersion) {
  52883. $fullVersion = $version;
  52884. }
  52885. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  52886. $version = $match[1];
  52887. }
  52888. if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
  52889. $version = substr($version, 0, strlen($version) - strlen($match[0]));
  52890. }
  52891. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  52892. return '9999999-dev';
  52893. }
  52894. if (stripos($version, 'dev-') === 0) {
  52895. return 'dev-' . substr($version, 4);
  52896. }
  52897. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  52898. $version = $match[1];
  52899. }
  52900. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  52901. $version = $matches[1]
  52902. . (!empty($matches[2]) ? $matches[2] : '.0')
  52903. . (!empty($matches[3]) ? $matches[3] : '.0')
  52904. . (!empty($matches[4]) ? $matches[4] : '.0');
  52905. $index = 5;
  52906. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  52907. $version = preg_replace('{\D}', '.', $matches[1]);
  52908. $index = 2;
  52909. }
  52910. if (isset($index)) {
  52911. if (!empty($matches[$index])) {
  52912. if ('stable' === $matches[$index]) {
  52913. return $version;
  52914. }
  52915. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  52916. }
  52917. if (!empty($matches[$index + 2])) {
  52918. $version .= '-dev';
  52919. }
  52920. return $version;
  52921. }
  52922. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  52923. try {
  52924. $normalized = $this->normalizeBranch($match[1]);
  52925. if (strpos($normalized, 'dev-') === false) {
  52926. return $normalized;
  52927. }
  52928. } catch (\Exception $e) {
  52929. }
  52930. }
  52931. $extraMessage = '';
  52932. if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
  52933. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  52934. } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
  52935. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  52936. }
  52937. throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
  52938. }
  52939. public function parseNumericAliasPrefix($branch)
  52940. {
  52941. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  52942. return $matches['version'] . '.';
  52943. }
  52944. return false;
  52945. }
  52946. public function normalizeBranch($name)
  52947. {
  52948. $name = trim($name);
  52949. if (in_array($name, array('master', 'trunk', 'default'))) {
  52950. return $this->normalize($name);
  52951. }
  52952. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  52953. $version = '';
  52954. for ($i = 1; $i < 5; ++$i) {
  52955. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  52956. }
  52957. return str_replace('x', '9999999', $version) . '-dev';
  52958. }
  52959. return 'dev-' . $name;
  52960. }
  52961. public function parseConstraints($constraints)
  52962. {
  52963. $prettyConstraint = $constraints;
  52964. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  52965. $orGroups = array();
  52966. foreach ($orConstraints as $constraints) {
  52967. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  52968. if (count($andConstraints) > 1) {
  52969. $constraintObjects = array();
  52970. foreach ($andConstraints as $constraint) {
  52971. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  52972. $constraintObjects[] = $parsedConstraint;
  52973. }
  52974. }
  52975. } else {
  52976. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  52977. }
  52978. if (1 === count($constraintObjects)) {
  52979. $constraint = $constraintObjects[0];
  52980. } else {
  52981. $constraint = new MultiConstraint($constraintObjects);
  52982. }
  52983. $orGroups[] = $constraint;
  52984. }
  52985. if (1 === count($orGroups)) {
  52986. $constraint = $orGroups[0];
  52987. } elseif (2 === count($orGroups)
  52988. && $orGroups[0] instanceof MultiConstraint
  52989. && $orGroups[1] instanceof MultiConstraint
  52990. && 2 === count($orGroups[0]->getConstraints())
  52991. && 2 === count($orGroups[1]->getConstraints())
  52992. && ($a = (string) $orGroups[0])
  52993. && strpos($a, '[>=') === 0 && (false !== ($posA = strpos($a, '<', 4)))
  52994. && ($b = (string) $orGroups[1])
  52995. && strpos($b, '[>=') === 0 && (false !== ($posB = strpos($b, '<', 4)))
  52996. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  52997. ) {
  52998. $constraint = new MultiConstraint(array(
  52999. new Constraint('>=', substr($a, 4, $posA - 5)),
  53000. new Constraint('<', substr($b, $posB + 2, -1)),
  53001. ));
  53002. } else {
  53003. $constraint = new MultiConstraint($orGroups, false);
  53004. }
  53005. $constraint->setPrettyString($prettyConstraint);
  53006. return $constraint;
  53007. }
  53008. private function parseConstraint($constraint)
  53009. {
  53010. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
  53011. $constraint = $match[1];
  53012. }
  53013. if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
  53014. $constraint = '' !== $match[1] ? $match[1] : '*';
  53015. if ($match[2] !== 'stable') {
  53016. $stabilityModifier = $match[2];
  53017. }
  53018. }
  53019. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
  53020. $constraint = $match[1];
  53021. }
  53022. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  53023. return array(new EmptyConstraint());
  53024. }
  53025. $versionRegex = 'v?(\d++)(?:\.(\d++|[xX*]))?(?:\.(\d++|[xX*]))?(?:\.(\d++|[xX*]))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  53026. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  53027. if (strpos($constraint, '~>') === 0) {
  53028. throw new \UnexpectedValueException(
  53029. 'Could not parse version constraint ' . $constraint . ': ' .
  53030. 'Invalid operator "~>", you probably meant to use the "~" operator'
  53031. );
  53032. }
  53033. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  53034. $position = 4;
  53035. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53036. $position = 3;
  53037. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53038. $position = 2;
  53039. } else {
  53040. $position = 1;
  53041. }
  53042. for ($i = $position; $i >= 0; $i--) {
  53043. if ($matches[$i] === 'x' || $matches[$i] === 'X' || $matches[$i] === '*') {
  53044. $matches[$i] = '9999999';
  53045. }
  53046. }
  53047. $stabilitySuffix = '';
  53048. if (empty($matches[5]) && empty($matches[7])) {
  53049. $stabilitySuffix .= '-dev';
  53050. }
  53051. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53052. $lowerBound = new Constraint('>=', $lowVersion);
  53053. $highPosition = max(1, $position - 1);
  53054. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  53055. $upperBound = new Constraint('<', $highVersion);
  53056. return array(
  53057. $lowerBound,
  53058. $upperBound,
  53059. );
  53060. }
  53061. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  53062. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  53063. $position = 1;
  53064. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  53065. $position = 2;
  53066. } else {
  53067. $position = 3;
  53068. }
  53069. if ($position === 2 && ($matches[2] === 'x' || $matches[2] === 'X' || $matches[2] === '*')) {
  53070. $position = 1;
  53071. }
  53072. $stabilitySuffix = '';
  53073. if (empty($matches[5]) && empty($matches[7])) {
  53074. $stabilitySuffix .= '-dev';
  53075. }
  53076. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53077. $lowerBound = new Constraint('>=', $lowVersion);
  53078. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53079. $upperBound = new Constraint('<', $highVersion);
  53080. return array(
  53081. $lowerBound,
  53082. $upperBound,
  53083. );
  53084. }
  53085. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  53086. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53087. $position = 3;
  53088. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53089. $position = 2;
  53090. } else {
  53091. $position = 1;
  53092. }
  53093. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  53094. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53095. if ($lowVersion === '0.0.0.0-dev') {
  53096. return array(new Constraint('<', $highVersion));
  53097. }
  53098. return array(
  53099. new Constraint('>=', $lowVersion),
  53100. new Constraint('<', $highVersion),
  53101. );
  53102. }
  53103. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  53104. $lowStabilitySuffix = '';
  53105. if (empty($matches[6]) && empty($matches[8])) {
  53106. $lowStabilitySuffix = '-dev';
  53107. }
  53108. $lowVersion = $this->normalize($matches['from']);
  53109. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  53110. $empty = function ($x) {
  53111. return ($x === 0 || $x === '0') ? false : empty($x);
  53112. };
  53113. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  53114. $highVersion = $this->normalize($matches['to']);
  53115. $upperBound = new Constraint('<=', $highVersion);
  53116. } else {
  53117. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  53118. $this->normalize($matches['to']);
  53119. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  53120. $upperBound = new Constraint('<', $highVersion);
  53121. }
  53122. return array(
  53123. $lowerBound,
  53124. $upperBound,
  53125. );
  53126. }
  53127. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  53128. try {
  53129. try {
  53130. $version = $this->normalize($matches[2]);
  53131. } catch (\UnexpectedValueException $e) {
  53132. if (substr($matches[2], -4) === '-dev') {
  53133. $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
  53134. } else {
  53135. throw $e;
  53136. }
  53137. }
  53138. $op = $matches[1] ?: '=';
  53139. if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  53140. $version .= '-' . $stabilityModifier;
  53141. } elseif ('<' === $op || '>=' === $op) {
  53142. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  53143. if (strpos($matches[2], 'dev-') !== 0) {
  53144. $version .= '-dev';
  53145. }
  53146. }
  53147. }
  53148. return array(new Constraint($matches[1] ?: '=', $version));
  53149. } catch (\Exception $e) {
  53150. }
  53151. }
  53152. $message = 'Could not parse version constraint ' . $constraint;
  53153. if (isset($e)) {
  53154. $message .= ': ' . $e->getMessage();
  53155. }
  53156. throw new \UnexpectedValueException($message);
  53157. }
  53158. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  53159. {
  53160. for ($i = 4; $i > 0; --$i) {
  53161. if ($i > $position) {
  53162. $matches[$i] = $pad;
  53163. } elseif ($i === $position && $increment) {
  53164. $matches[$i] += $increment;
  53165. if ($matches[$i] < 0) {
  53166. $matches[$i] = $pad;
  53167. --$position;
  53168. if ($i === 1) {
  53169. return null;
  53170. }
  53171. }
  53172. }
  53173. }
  53174. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  53175. }
  53176. private function expandStability($stability)
  53177. {
  53178. $stability = strtolower($stability);
  53179. switch ($stability) {
  53180. case 'a':
  53181. return 'alpha';
  53182. case 'b':
  53183. return 'beta';
  53184. case 'p':
  53185. case 'pl':
  53186. return 'patch';
  53187. case 'rc':
  53188. return 'RC';
  53189. default:
  53190. return $stability;
  53191. }
  53192. }
  53193. }
  53194. Copyright (C) 2016 Composer
  53195. Permission is hereby granted, free of charge, to any person obtaining a copy of
  53196. this software and associated documentation files (the "Software"), to deal in
  53197. the Software without restriction, including without limitation the rights to
  53198. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  53199. of the Software, and to permit persons to whom the Software is furnished to do
  53200. so, subject to the following conditions:
  53201. The above copyright notice and this permission notice shall be included in all
  53202. copies or substantial portions of the Software.
  53203. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53204. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53205. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53206. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53207. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53208. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53209. SOFTWARE.
  53210. <?php
  53211. namespace Composer\CaBundle;
  53212. use Psr\Log\LoggerInterface;
  53213. use Symfony\Component\Process\PhpProcess;
  53214. class CaBundle
  53215. {
  53216. private static $caPath;
  53217. private static $caFileValidity = array();
  53218. private static $useOpensslParse;
  53219. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  53220. {
  53221. if (self::$caPath !== null) {
  53222. return self::$caPath;
  53223. }
  53224. $caBundlePaths = array();
  53225. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  53226. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  53227. $caBundlePaths[] = ini_get('openssl.cafile');
  53228. $caBundlePaths[] = ini_get('openssl.capath');
  53229. $otherLocations = array(
  53230. '/etc/pki/tls/certs/ca-bundle.crt',
  53231. '/etc/ssl/certs/ca-certificates.crt',
  53232. '/etc/ssl/ca-bundle.pem',
  53233. '/usr/local/share/certs/ca-root-nss.crt',
  53234. '/usr/ssl/certs/ca-bundle.crt',
  53235. '/opt/local/share/curl/curl-ca-bundle.crt',
  53236. '/usr/local/share/curl/curl-ca-bundle.crt',
  53237. '/usr/share/ssl/certs/ca-bundle.crt',
  53238. '/etc/ssl/cert.pem',
  53239. '/usr/local/etc/ssl/cert.pem',
  53240. '/usr/local/etc/openssl/cert.pem',
  53241. '/usr/local/etc/openssl@1.1/cert.pem',
  53242. );
  53243. foreach($otherLocations as $location) {
  53244. $otherLocations[] = dirname($location);
  53245. }
  53246. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  53247. foreach ($caBundlePaths as $caBundle) {
  53248. if (self::caFileUsable($caBundle, $logger)) {
  53249. return self::$caPath = $caBundle;
  53250. }
  53251. if (self::caDirUsable($caBundle)) {
  53252. return self::$caPath = $caBundle;
  53253. }
  53254. }
  53255. return self::$caPath = static::getBundledCaBundlePath();
  53256. }
  53257. public static function getBundledCaBundlePath()
  53258. {
  53259. $caBundleFile = __DIR__.'/../res/cacert.pem';
  53260. if (0 === strpos($caBundleFile, 'phar://')) {
  53261. file_put_contents(
  53262. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  53263. file_get_contents($caBundleFile)
  53264. );
  53265. register_shutdown_function(function() use ($tempCaBundleFile) {
  53266. @unlink($tempCaBundleFile);
  53267. });
  53268. $caBundleFile = $tempCaBundleFile;
  53269. }
  53270. return $caBundleFile;
  53271. }
  53272. public static function validateCaFile($filename, LoggerInterface $logger = null)
  53273. {
  53274. static $warned = false;
  53275. if (isset(self::$caFileValidity[$filename])) {
  53276. return self::$caFileValidity[$filename];
  53277. }
  53278. $contents = file_get_contents($filename);
  53279. if (!static::isOpensslParseSafe()) {
  53280. if (!$warned && $logger) {
  53281. $logger->warning(sprintf(
  53282. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  53283. PHP_VERSION
  53284. ));
  53285. $warned = true;
  53286. }
  53287. $isValid = !empty($contents);
  53288. } else {
  53289. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  53290. $isValid = (bool) openssl_x509_parse($contents);
  53291. }
  53292. if ($logger) {
  53293. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  53294. }
  53295. return self::$caFileValidity[$filename] = $isValid;
  53296. }
  53297. public static function isOpensslParseSafe()
  53298. {
  53299. if (null !== self::$useOpensslParse) {
  53300. return self::$useOpensslParse;
  53301. }
  53302. if (PHP_VERSION_ID >= 50600) {
  53303. return self::$useOpensslParse = true;
  53304. }
  53305. if (
  53306. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  53307. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  53308. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  53309. ) {
  53310. return self::$useOpensslParse = true;
  53311. }
  53312. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53313. return self::$useOpensslParse = false;
  53314. }
  53315. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  53316. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  53317. if (preg_match($regex, PHP_VERSION, $m)) {
  53318. return ((int) $m[1]) >= $fixedVersion;
  53319. }
  53320. return false;
  53321. };
  53322. if (
  53323. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  53324. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  53325. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  53326. ) {
  53327. return self::$useOpensslParse = true;
  53328. }
  53329. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  53330. return self::$useOpensslParse = false;
  53331. }
  53332. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  53333. $script = <<<'EOT'
  53334. error_reporting(-1);
  53335. $info = openssl_x509_parse(base64_decode('%s'));
  53336. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  53337. EOT;
  53338. $script = '<'."?php\n".sprintf($script, $cert);
  53339. try {
  53340. $process = new PhpProcess($script);
  53341. $process->mustRun();
  53342. } catch (\Exception $e) {
  53343. return self::$useOpensslParse = false;
  53344. }
  53345. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  53346. $errorOutput = trim($process->getErrorOutput());
  53347. if (
  53348. count($output) === 3
  53349. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  53350. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  53351. && $output[2] === 'int(-1)'
  53352. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  53353. ) {
  53354. return self::$useOpensslParse = true;
  53355. }
  53356. return self::$useOpensslParse = false;
  53357. }
  53358. public static function reset()
  53359. {
  53360. self::$caFileValidity = array();
  53361. self::$caPath = null;
  53362. self::$useOpensslParse = null;
  53363. }
  53364. private static function getEnvVariable($name)
  53365. {
  53366. if (isset($_SERVER[$name])) {
  53367. return (string) $_SERVER[$name];
  53368. }
  53369. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  53370. return (string) $value;
  53371. }
  53372. return false;
  53373. }
  53374. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  53375. {
  53376. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  53377. }
  53378. private static function caDirUsable($certDir)
  53379. {
  53380. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  53381. }
  53382. }
  53383. MIT License
  53384. Copyright (c) 2017 Composer
  53385. Permission is hereby granted, free of charge, to any person obtaining a copy
  53386. of this software and associated documentation files (the "Software"), to deal
  53387. in the Software without restriction, including without limitation the rights
  53388. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53389. copies of the Software, and to permit persons to whom the Software is
  53390. furnished to do so, subject to the following conditions:
  53391. The above copyright notice and this permission notice shall be included in all
  53392. copies or substantial portions of the Software.
  53393. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53394. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53395. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53396. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53397. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53398. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53399. SOFTWARE.
  53400. <?php
  53401. namespace Composer\XdebugHandler;
  53402. class PhpConfig
  53403. {
  53404. public function useOriginal()
  53405. {
  53406. $this->getDataAndReset();
  53407. return array();
  53408. }
  53409. public function useStandard()
  53410. {
  53411. if ($data = $this->getDataAndReset()) {
  53412. return array('-n', '-c', $data['tmpIni']);
  53413. }
  53414. return array();
  53415. }
  53416. public function usePersistent()
  53417. {
  53418. if ($data = $this->getDataAndReset()) {
  53419. Process::setEnv('PHPRC', $data['tmpIni']);
  53420. Process::setEnv('PHP_INI_SCAN_DIR', '');
  53421. }
  53422. return array();
  53423. }
  53424. private function getDataAndReset()
  53425. {
  53426. if ($data = XdebugHandler::getRestartSettings()) {
  53427. Process::setEnv('PHPRC', $data['phprc']);
  53428. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  53429. }
  53430. return $data;
  53431. }
  53432. }
  53433. <?php
  53434. namespace Composer\XdebugHandler;
  53435. class Process
  53436. {
  53437. public static function addColorOption(array $args, $colorOption)
  53438. {
  53439. if (!$colorOption
  53440. || in_array($colorOption, $args)
  53441. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  53442. return $args;
  53443. }
  53444. if (isset($matches[2])) {
  53445. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  53446. $args[$index] = $colorOption;
  53447. return $args;
  53448. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  53449. return $args;
  53450. }
  53451. } elseif (in_array('--no-'.$matches[1], $args)) {
  53452. return $args;
  53453. }
  53454. if (false !== getenv('NO_COLOR')) {
  53455. return $args;
  53456. }
  53457. if (false !== ($index = array_search('--', $args))) {
  53458. array_splice($args, $index, 0, $colorOption);
  53459. } else {
  53460. $args[] = $colorOption;
  53461. }
  53462. return $args;
  53463. }
  53464. public static function escape($arg, $meta = true, $module = false)
  53465. {
  53466. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  53467. return "'".str_replace("'", "'\\''", $arg)."'";
  53468. }
  53469. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  53470. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  53471. if ($meta) {
  53472. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  53473. if (!$meta) {
  53474. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  53475. } elseif ($module && !$dquotes && $quote) {
  53476. $meta = false;
  53477. }
  53478. }
  53479. if ($quote) {
  53480. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  53481. }
  53482. if ($meta) {
  53483. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  53484. }
  53485. return $arg;
  53486. }
  53487. public static function supportsColor($output)
  53488. {
  53489. if ('Hyper' === getenv('TERM_PROGRAM')) {
  53490. return true;
  53491. }
  53492. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53493. return (function_exists('sapi_windows_vt100_support')
  53494. && sapi_windows_vt100_support($output))
  53495. || false !== getenv('ANSICON')
  53496. || 'ON' === getenv('ConEmuANSI')
  53497. || 'xterm' === getenv('TERM');
  53498. }
  53499. if (function_exists('stream_isatty')) {
  53500. return stream_isatty($output);
  53501. }
  53502. if (function_exists('posix_isatty')) {
  53503. return posix_isatty($output);
  53504. }
  53505. $stat = fstat($output);
  53506. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  53507. }
  53508. public static function setEnv($name, $value = false)
  53509. {
  53510. $unset = false === $value;
  53511. if (!putenv($unset ? $name : $name.'='.$value)) {
  53512. return false;
  53513. }
  53514. if ($unset) {
  53515. unset($_SERVER[$name]);
  53516. } else {
  53517. $_SERVER[$name] = $value;
  53518. }
  53519. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  53520. if ($unset) {
  53521. unset($_ENV[$name]);
  53522. } else {
  53523. $_ENV[$name] = $value;
  53524. }
  53525. }
  53526. return true;
  53527. }
  53528. }
  53529. <?php
  53530. namespace Composer\XdebugHandler;
  53531. use Psr\Log\LoggerInterface;
  53532. use Psr\Log\LogLevel;
  53533. class Status
  53534. {
  53535. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  53536. const CHECK = 'Check';
  53537. const ERROR = 'Error';
  53538. const INFO = 'Info';
  53539. const NORESTART = 'NoRestart';
  53540. const RESTART = 'Restart';
  53541. const RESTARTING = 'Restarting';
  53542. const RESTARTED = 'Restarted';
  53543. private $debug;
  53544. private $envAllowXdebug;
  53545. private $loaded;
  53546. private $logger;
  53547. private $time;
  53548. public function __construct($envAllowXdebug, $debug)
  53549. {
  53550. $start = getenv(self::ENV_RESTART);
  53551. Process::setEnv(self::ENV_RESTART);
  53552. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  53553. $this->envAllowXdebug = $envAllowXdebug;
  53554. $this->debug = $debug && defined('STDERR');
  53555. }
  53556. public function setLogger(LoggerInterface $logger)
  53557. {
  53558. $this->logger = $logger;
  53559. }
  53560. public function report($op, $data)
  53561. {
  53562. if ($this->logger || $this->debug) {
  53563. call_user_func(array($this, 'report'.$op), $data);
  53564. }
  53565. }
  53566. private function output($text, $level = null)
  53567. {
  53568. if ($this->logger) {
  53569. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  53570. }
  53571. if ($this->debug) {
  53572. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  53573. }
  53574. }
  53575. private function reportCheck($loaded)
  53576. {
  53577. $this->loaded = $loaded;
  53578. $this->output('Checking '.$this->envAllowXdebug);
  53579. }
  53580. private function reportError($error)
  53581. {
  53582. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  53583. }
  53584. private function reportInfo($info)
  53585. {
  53586. $this->output($info);
  53587. }
  53588. private function reportNoRestart()
  53589. {
  53590. $this->output($this->getLoadedMessage());
  53591. if ($this->loaded) {
  53592. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  53593. if (!getenv($this->envAllowXdebug)) {
  53594. $text .= ' Allowed by application';
  53595. }
  53596. $this->output($text);
  53597. }
  53598. }
  53599. private function reportRestart()
  53600. {
  53601. $this->output($this->getLoadedMessage());
  53602. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  53603. }
  53604. private function reportRestarted()
  53605. {
  53606. $loaded = $this->getLoadedMessage();
  53607. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  53608. $level = $this->loaded ? LogLevel::WARNING : null;
  53609. $this->output($text, $level);
  53610. }
  53611. private function reportRestarting($command)
  53612. {
  53613. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  53614. $this->output($text);
  53615. $text = 'Running '.$command;
  53616. $this->output($text);
  53617. }
  53618. private function getEnvAllow()
  53619. {
  53620. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  53621. }
  53622. private function getLoadedMessage()
  53623. {
  53624. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  53625. return 'The Xdebug extension is '.$loaded;
  53626. }
  53627. }
  53628. <?php
  53629. namespace Composer\XdebugHandler;
  53630. use Psr\Log\LoggerInterface;
  53631. class XdebugHandler
  53632. {
  53633. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  53634. const SUFFIX_INIS = '_ORIGINAL_INIS';
  53635. const RESTART_ID = 'internal';
  53636. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  53637. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  53638. protected $tmpIni;
  53639. private static $inRestart;
  53640. private static $name;
  53641. private static $skipped;
  53642. private $cli;
  53643. private $colorOption;
  53644. private $debug;
  53645. private $envAllowXdebug;
  53646. private $envOriginalInis;
  53647. private $loaded;
  53648. private $persistent;
  53649. private $script;
  53650. private $statusWriter;
  53651. public function __construct($envPrefix, $colorOption = '')
  53652. {
  53653. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  53654. throw new \RuntimeException('Invalid constructor parameter');
  53655. }
  53656. self::$name = strtoupper($envPrefix);
  53657. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  53658. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  53659. $this->colorOption = $colorOption;
  53660. if (extension_loaded('xdebug')) {
  53661. $ext = new \ReflectionExtension('xdebug');
  53662. $this->loaded = $ext->getVersion() ?: 'unknown';
  53663. }
  53664. if ($this->cli = PHP_SAPI === 'cli') {
  53665. $this->debug = getenv(self::DEBUG);
  53666. }
  53667. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  53668. }
  53669. public function setLogger(LoggerInterface $logger)
  53670. {
  53671. $this->statusWriter->setLogger($logger);
  53672. return $this;
  53673. }
  53674. public function setMainScript($script)
  53675. {
  53676. $this->script = $script;
  53677. return $this;
  53678. }
  53679. public function setPersistent()
  53680. {
  53681. $this->persistent = true;
  53682. return $this;
  53683. }
  53684. public function check()
  53685. {
  53686. $this->notify(Status::CHECK, $this->loaded);
  53687. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  53688. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  53689. $this->notify(Status::RESTART);
  53690. if ($this->prepareRestart()) {
  53691. $command = $this->getCommand();
  53692. $this->restart($command);
  53693. }
  53694. return;
  53695. }
  53696. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  53697. $this->notify(Status::RESTARTED);
  53698. Process::setEnv($this->envAllowXdebug);
  53699. self::$inRestart = true;
  53700. if (!$this->loaded) {
  53701. self::$skipped = $envArgs[1];
  53702. }
  53703. $this->tryEnableSignals();
  53704. $this->setEnvRestartSettings($envArgs);
  53705. return;
  53706. }
  53707. $this->notify(Status::NORESTART);
  53708. if ($settings = self::getRestartSettings()) {
  53709. $this->syncSettings($settings);
  53710. }
  53711. }
  53712. public static function getAllIniFiles()
  53713. {
  53714. if (!empty(self::$name)) {
  53715. $env = getenv(self::$name.self::SUFFIX_INIS);
  53716. if (false !== $env) {
  53717. return explode(PATH_SEPARATOR, $env);
  53718. }
  53719. }
  53720. $paths = array((string) php_ini_loaded_file());
  53721. if ($scanned = php_ini_scanned_files()) {
  53722. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  53723. }
  53724. return $paths;
  53725. }
  53726. public static function getRestartSettings()
  53727. {
  53728. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  53729. if (count($envArgs) !== 6
  53730. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  53731. return;
  53732. }
  53733. return array(
  53734. 'tmpIni' => $envArgs[0],
  53735. 'scannedInis' => (bool) $envArgs[1],
  53736. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  53737. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  53738. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  53739. 'skipped' => $envArgs[5],
  53740. );
  53741. }
  53742. public static function getSkippedVersion()
  53743. {
  53744. return (string) self::$skipped;
  53745. }
  53746. protected function requiresRestart($isLoaded)
  53747. {
  53748. return $isLoaded;
  53749. }
  53750. protected function restart($command)
  53751. {
  53752. $this->doRestart($command);
  53753. }
  53754. private function doRestart($command)
  53755. {
  53756. $this->tryEnableSignals();
  53757. $this->notify(Status::RESTARTING, $command);
  53758. passthru($command, $exitCode);
  53759. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  53760. if ($this->debug === '2') {
  53761. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  53762. } else {
  53763. @unlink($this->tmpIni);
  53764. }
  53765. exit($exitCode);
  53766. }
  53767. private function prepareRestart()
  53768. {
  53769. $error = '';
  53770. $iniFiles = self::getAllIniFiles();
  53771. $scannedInis = count($iniFiles) > 1;
  53772. $tmpDir = sys_get_temp_dir();
  53773. if (!$this->cli) {
  53774. $error = 'Unsupported SAPI: '.PHP_SAPI;
  53775. } elseif (!defined('PHP_BINARY')) {
  53776. $error = 'PHP version is too old: '.PHP_VERSION;
  53777. } elseif (!$this->checkConfiguration($info)) {
  53778. $error = $info;
  53779. } elseif (!$this->checkScanDirConfig()) {
  53780. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  53781. } elseif (!$this->checkMainScript()) {
  53782. $error = 'Unable to access main script: '.$this->script;
  53783. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  53784. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  53785. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  53786. $error = 'Unable to set environment variables';
  53787. }
  53788. if ($error) {
  53789. $this->notify(Status::ERROR, $error);
  53790. }
  53791. return empty($error);
  53792. }
  53793. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  53794. {
  53795. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  53796. return false;
  53797. }
  53798. if (empty($iniFiles[0])) {
  53799. array_shift($iniFiles);
  53800. }
  53801. $content = '';
  53802. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  53803. foreach ($iniFiles as $file) {
  53804. if (($data = @file_get_contents($file)) === false) {
  53805. $error = 'Unable to read ini: '.$file;
  53806. return false;
  53807. }
  53808. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  53809. }
  53810. if ($config = parse_ini_string($content)) {
  53811. $loaded = ini_get_all(null, false);
  53812. $content .= $this->mergeLoadedConfig($loaded, $config);
  53813. }
  53814. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  53815. return @file_put_contents($this->tmpIni, $content);
  53816. }
  53817. private function getCommand()
  53818. {
  53819. $php = array(PHP_BINARY);
  53820. $args = array_slice($_SERVER['argv'], 1);
  53821. if (!$this->persistent) {
  53822. array_push($php, '-n', '-c', $this->tmpIni);
  53823. }
  53824. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  53825. $args = Process::addColorOption($args, $this->colorOption);
  53826. }
  53827. $args = array_merge($php, array($this->script), $args);
  53828. $cmd = Process::escape(array_shift($args), true, true);
  53829. foreach ($args as $arg) {
  53830. $cmd .= ' '.Process::escape($arg);
  53831. }
  53832. return $cmd;
  53833. }
  53834. private function setEnvironment($scannedInis, array $iniFiles)
  53835. {
  53836. $scanDir = getenv('PHP_INI_SCAN_DIR');
  53837. $phprc = getenv('PHPRC');
  53838. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  53839. return false;
  53840. }
  53841. if ($this->persistent) {
  53842. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  53843. return false;
  53844. }
  53845. }
  53846. $envArgs = array(
  53847. self::RESTART_ID,
  53848. $this->loaded,
  53849. (int) $scannedInis,
  53850. false === $scanDir ? '*' : $scanDir,
  53851. false === $phprc ? '*' : $phprc,
  53852. );
  53853. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  53854. }
  53855. private function notify($op, $data = null)
  53856. {
  53857. $this->statusWriter->report($op, $data);
  53858. }
  53859. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  53860. {
  53861. $content = '';
  53862. foreach ($loadedConfig as $name => $value) {
  53863. if (!is_string($value)
  53864. || strpos($name, 'xdebug') === 0
  53865. || $name === 'apc.mmap_file_mask') {
  53866. continue;
  53867. }
  53868. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  53869. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  53870. }
  53871. }
  53872. return $content;
  53873. }
  53874. private function checkMainScript()
  53875. {
  53876. if (null !== $this->script) {
  53877. return file_exists($this->script) || '--' === $this->script;
  53878. }
  53879. if (file_exists($this->script = $_SERVER['argv'][0])) {
  53880. return true;
  53881. }
  53882. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  53883. $trace = debug_backtrace($options);
  53884. if (($main = end($trace)) && isset($main['file'])) {
  53885. return file_exists($this->script = $main['file']);
  53886. }
  53887. return false;
  53888. }
  53889. private function setEnvRestartSettings($envArgs)
  53890. {
  53891. $settings = array(
  53892. php_ini_loaded_file(),
  53893. $envArgs[2],
  53894. $envArgs[3],
  53895. $envArgs[4],
  53896. getenv($this->envOriginalInis),
  53897. self::$skipped,
  53898. );
  53899. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  53900. }
  53901. private function syncSettings(array $settings)
  53902. {
  53903. if (false === getenv($this->envOriginalInis)) {
  53904. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  53905. }
  53906. self::$skipped = $settings['skipped'];
  53907. $this->notify(Status::INFO, 'Process called with existing restart settings');
  53908. }
  53909. private function checkScanDirConfig()
  53910. {
  53911. return !(getenv('PHP_INI_SCAN_DIR')
  53912. && !PHP_CONFIG_FILE_SCAN_DIR
  53913. && (PHP_VERSION_ID < 70113
  53914. || PHP_VERSION_ID === 70200));
  53915. }
  53916. private function checkConfiguration(&$info)
  53917. {
  53918. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  53919. $info = 'passthru function is disabled';
  53920. return false;
  53921. }
  53922. if (extension_loaded('uopz') && !ini_get('uopz.disable')) {
  53923. if (function_exists('uopz_allow_exit')) {
  53924. @uopz_allow_exit(true);
  53925. } else {
  53926. $info = 'uopz extension is not compatible';
  53927. return false;
  53928. }
  53929. }
  53930. return true;
  53931. }
  53932. private function tryEnableSignals()
  53933. {
  53934. if (!function_exists('pcntl_async_signals')) {
  53935. return;
  53936. }
  53937. pcntl_async_signals(true);
  53938. $message = 'Async signals enabled';
  53939. if (!self::$inRestart) {
  53940. pcntl_signal(SIGINT, SIG_IGN);
  53941. $message .= ' (SIGINT = SIG_IGN)';
  53942. } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
  53943. pcntl_signal(SIGINT, SIG_DFL);
  53944. $message .= ' (SIGINT = SIG_DFL)';
  53945. }
  53946. $this->notify(Status::INFO, $message);
  53947. }
  53948. }
  53949. Copyright (c) 2012 PHP Framework Interoperability Group
  53950. Permission is hereby granted, free of charge, to any person obtaining a copy
  53951. of this software and associated documentation files (the "Software"), to deal
  53952. in the Software without restriction, including without limitation the rights
  53953. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53954. copies of the Software, and to permit persons to whom the Software is
  53955. furnished to do so, subject to the following conditions:
  53956. The above copyright notice and this permission notice shall be included in
  53957. all copies or substantial portions of the Software.
  53958. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53959. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53960. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53961. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53962. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53963. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53964. THE SOFTWARE.
  53965. <?php
  53966. namespace Psr\Log;
  53967. abstract class AbstractLogger implements LoggerInterface
  53968. {
  53969. public function emergency($message, array $context = array())
  53970. {
  53971. $this->log(LogLevel::EMERGENCY, $message, $context);
  53972. }
  53973. public function alert($message, array $context = array())
  53974. {
  53975. $this->log(LogLevel::ALERT, $message, $context);
  53976. }
  53977. public function critical($message, array $context = array())
  53978. {
  53979. $this->log(LogLevel::CRITICAL, $message, $context);
  53980. }
  53981. public function error($message, array $context = array())
  53982. {
  53983. $this->log(LogLevel::ERROR, $message, $context);
  53984. }
  53985. public function warning($message, array $context = array())
  53986. {
  53987. $this->log(LogLevel::WARNING, $message, $context);
  53988. }
  53989. public function notice($message, array $context = array())
  53990. {
  53991. $this->log(LogLevel::NOTICE, $message, $context);
  53992. }
  53993. public function info($message, array $context = array())
  53994. {
  53995. $this->log(LogLevel::INFO, $message, $context);
  53996. }
  53997. public function debug($message, array $context = array())
  53998. {
  53999. $this->log(LogLevel::DEBUG, $message, $context);
  54000. }
  54001. }
  54002. <?php
  54003. namespace Psr\Log;
  54004. class InvalidArgumentException extends \InvalidArgumentException
  54005. {
  54006. }
  54007. <?php
  54008. namespace Psr\Log;
  54009. class LogLevel
  54010. {
  54011. const EMERGENCY = 'emergency';
  54012. const ALERT = 'alert';
  54013. const CRITICAL = 'critical';
  54014. const ERROR = 'error';
  54015. const WARNING = 'warning';
  54016. const NOTICE = 'notice';
  54017. const INFO = 'info';
  54018. const DEBUG = 'debug';
  54019. }
  54020. <?php
  54021. namespace Psr\Log;
  54022. interface LoggerAwareInterface
  54023. {
  54024. public function setLogger(LoggerInterface $logger);
  54025. }
  54026. <?php
  54027. namespace Psr\Log;
  54028. trait LoggerAwareTrait
  54029. {
  54030. protected $logger;
  54031. public function setLogger(LoggerInterface $logger)
  54032. {
  54033. $this->logger = $logger;
  54034. }
  54035. }
  54036. <?php
  54037. namespace Psr\Log;
  54038. interface LoggerInterface
  54039. {
  54040. public function emergency($message, array $context = array());
  54041. public function alert($message, array $context = array());
  54042. public function critical($message, array $context = array());
  54043. public function error($message, array $context = array());
  54044. public function warning($message, array $context = array());
  54045. public function notice($message, array $context = array());
  54046. public function info($message, array $context = array());
  54047. public function debug($message, array $context = array());
  54048. public function log($level, $message, array $context = array());
  54049. }
  54050. <?php
  54051. namespace Psr\Log;
  54052. trait LoggerTrait
  54053. {
  54054. public function emergency($message, array $context = array())
  54055. {
  54056. $this->log(LogLevel::EMERGENCY, $message, $context);
  54057. }
  54058. public function alert($message, array $context = array())
  54059. {
  54060. $this->log(LogLevel::ALERT, $message, $context);
  54061. }
  54062. public function critical($message, array $context = array())
  54063. {
  54064. $this->log(LogLevel::CRITICAL, $message, $context);
  54065. }
  54066. public function error($message, array $context = array())
  54067. {
  54068. $this->log(LogLevel::ERROR, $message, $context);
  54069. }
  54070. public function warning($message, array $context = array())
  54071. {
  54072. $this->log(LogLevel::WARNING, $message, $context);
  54073. }
  54074. public function notice($message, array $context = array())
  54075. {
  54076. $this->log(LogLevel::NOTICE, $message, $context);
  54077. }
  54078. public function info($message, array $context = array())
  54079. {
  54080. $this->log(LogLevel::INFO, $message, $context);
  54081. }
  54082. public function debug($message, array $context = array())
  54083. {
  54084. $this->log(LogLevel::DEBUG, $message, $context);
  54085. }
  54086. abstract public function log($level, $message, array $context = array());
  54087. }
  54088. <?php
  54089. namespace Psr\Log;
  54090. class NullLogger extends AbstractLogger
  54091. {
  54092. public function log($level, $message, array $context = array())
  54093. {
  54094. }
  54095. }
  54096. <?php
  54097. namespace Psr\Log\Test;
  54098. class DummyTest
  54099. {
  54100. public function __toString()
  54101. {
  54102. return 'DummyTest';
  54103. }
  54104. }
  54105. <?php
  54106. namespace Psr\Log\Test;
  54107. use Psr\Log\LoggerInterface;
  54108. use Psr\Log\LogLevel;
  54109. use PHPUnit\Framework\TestCase;
  54110. abstract class LoggerInterfaceTest extends TestCase
  54111. {
  54112. abstract public function getLogger();
  54113. abstract public function getLogs();
  54114. public function testImplements()
  54115. {
  54116. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  54117. }
  54118. public function testLogsAtAllLevels($level, $message)
  54119. {
  54120. $logger = $this->getLogger();
  54121. $logger->{$level}($message, array('user' => 'Bob'));
  54122. $logger->log($level, $message, array('user' => 'Bob'));
  54123. $expected = array(
  54124. $level.' message of level '.$level.' with context: Bob',
  54125. $level.' message of level '.$level.' with context: Bob',
  54126. );
  54127. $this->assertEquals($expected, $this->getLogs());
  54128. }
  54129. public function provideLevelsAndMessages()
  54130. {
  54131. return array(
  54132. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  54133. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  54134. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  54135. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  54136. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  54137. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  54138. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  54139. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  54140. );
  54141. }
  54142. public function testThrowsOnInvalidLevel()
  54143. {
  54144. $logger = $this->getLogger();
  54145. $logger->log('invalid level', 'Foo');
  54146. }
  54147. public function testContextReplacement()
  54148. {
  54149. $logger = $this->getLogger();
  54150. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  54151. $expected = array('info {Message {nothing} Bob Bar a}');
  54152. $this->assertEquals($expected, $this->getLogs());
  54153. }
  54154. public function testObjectCastToString()
  54155. {
  54156. if (method_exists($this, 'createPartialMock')) {
  54157. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  54158. } else {
  54159. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  54160. }
  54161. $dummy->expects($this->once())
  54162. ->method('__toString')
  54163. ->will($this->returnValue('DUMMY'));
  54164. $this->getLogger()->warning($dummy);
  54165. $expected = array('warning DUMMY');
  54166. $this->assertEquals($expected, $this->getLogs());
  54167. }
  54168. public function testContextCanContainAnything()
  54169. {
  54170. $closed = fopen('php://memory', 'r');
  54171. fclose($closed);
  54172. $context = array(
  54173. 'bool' => true,
  54174. 'null' => null,
  54175. 'string' => 'Foo',
  54176. 'int' => 0,
  54177. 'float' => 0.5,
  54178. 'nested' => array('with object' => new DummyTest),
  54179. 'object' => new \DateTime,
  54180. 'resource' => fopen('php://memory', 'r'),
  54181. 'closed' => $closed,
  54182. );
  54183. $this->getLogger()->warning('Crazy context data', $context);
  54184. $expected = array('warning Crazy context data');
  54185. $this->assertEquals($expected, $this->getLogs());
  54186. }
  54187. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  54188. {
  54189. $logger = $this->getLogger();
  54190. $logger->warning('Random message', array('exception' => 'oops'));
  54191. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  54192. $expected = array(
  54193. 'warning Random message',
  54194. 'critical Uncaught Exception!'
  54195. );
  54196. $this->assertEquals($expected, $this->getLogs());
  54197. }
  54198. }
  54199. <?php
  54200. namespace Psr\Log\Test;
  54201. use Psr\Log\AbstractLogger;
  54202. class TestLogger extends AbstractLogger
  54203. {
  54204. public $records = [];
  54205. public $recordsByLevel = [];
  54206. public function log($level, $message, array $context = [])
  54207. {
  54208. $record = [
  54209. 'level' => $level,
  54210. 'message' => $message,
  54211. 'context' => $context,
  54212. ];
  54213. $this->recordsByLevel[$record['level']][] = $record;
  54214. $this->records[] = $record;
  54215. }
  54216. public function hasRecords($level)
  54217. {
  54218. return isset($this->recordsByLevel[$level]);
  54219. }
  54220. public function hasRecord($record, $level)
  54221. {
  54222. if (is_string($record)) {
  54223. $record = ['message' => $record];
  54224. }
  54225. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  54226. if ($rec['message'] !== $record['message']) {
  54227. return false;
  54228. }
  54229. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  54230. return false;
  54231. }
  54232. return true;
  54233. }, $level);
  54234. }
  54235. public function hasRecordThatContains($message, $level)
  54236. {
  54237. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  54238. return strpos($rec['message'], $message) !== false;
  54239. }, $level);
  54240. }
  54241. public function hasRecordThatMatches($regex, $level)
  54242. {
  54243. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  54244. return preg_match($regex, $rec['message']) > 0;
  54245. }, $level);
  54246. }
  54247. public function hasRecordThatPasses(callable $predicate, $level)
  54248. {
  54249. if (!isset($this->recordsByLevel[$level])) {
  54250. return false;
  54251. }
  54252. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  54253. if (call_user_func($predicate, $rec, $i)) {
  54254. return true;
  54255. }
  54256. }
  54257. return false;
  54258. }
  54259. public function __call($method, $args)
  54260. {
  54261. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  54262. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  54263. $level = strtolower($matches[2]);
  54264. if (method_exists($this, $genericMethod)) {
  54265. $args[] = $level;
  54266. return call_user_func_array([$this, $genericMethod], $args);
  54267. }
  54268. }
  54269. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  54270. }
  54271. public function reset()
  54272. {
  54273. $this->records = [];
  54274. $this->recordsByLevel = [];
  54275. }
  54276. }
  54277. <?php
  54278. require_once __DIR__ . '/composer/autoload_real.php';
  54279. return ComposerAutoloaderInitComposerPhar1599644794::getLoader();
  54280. <?php
  54281. $vendorDir = dirname(dirname(__FILE__));
  54282. $baseDir = dirname($vendorDir);
  54283. return array(
  54284. );
  54285. <?php
  54286. $vendorDir = dirname(dirname(__FILE__));
  54287. $baseDir = dirname($vendorDir);
  54288. return array(
  54289. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  54290. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  54291. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  54292. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  54293. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  54294. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  54295. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  54296. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  54297. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  54298. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  54299. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  54300. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  54301. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  54302. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  54303. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  54304. 'Composer\\' => array($baseDir . '/src/Composer'),
  54305. );
  54306. <?php
  54307. $vendorDir = dirname(dirname(__FILE__));
  54308. $baseDir = dirname($vendorDir);
  54309. return array(
  54310. );
  54311. <?php
  54312. $vendorDir = dirname(dirname(__FILE__));
  54313. $baseDir = dirname($vendorDir);
  54314. return array(
  54315. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  54316. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  54317. );
  54318. <?php
  54319. class ComposerAutoloaderInitComposerPhar1599644794
  54320. {
  54321. private static $loader;
  54322. public static function loadClassLoader($class)
  54323. {
  54324. if ('Composer\Autoload\ClassLoader' === $class) {
  54325. require __DIR__ . '/ClassLoader.php';
  54326. }
  54327. }
  54328. public static function getLoader()
  54329. {
  54330. if (null !== self::$loader) {
  54331. return self::$loader;
  54332. }
  54333. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1599644794', 'loadClassLoader'), true, true);
  54334. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  54335. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1599644794', 'loadClassLoader'));
  54336. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  54337. if ($useStaticLoader) {
  54338. require_once __DIR__ . '/autoload_static.php';
  54339. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1599644794::getInitializer($loader));
  54340. } else {
  54341. $map = require __DIR__ . '/autoload_namespaces.php';
  54342. foreach ($map as $namespace => $path) {
  54343. $loader->set($namespace, $path);
  54344. }
  54345. $map = require __DIR__ . '/autoload_psr4.php';
  54346. foreach ($map as $namespace => $path) {
  54347. $loader->setPsr4($namespace, $path);
  54348. }
  54349. $classMap = require __DIR__ . '/autoload_classmap.php';
  54350. if ($classMap) {
  54351. $loader->addClassMap($classMap);
  54352. }
  54353. }
  54354. $loader->register(true);
  54355. if ($useStaticLoader) {
  54356. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1599644794::$files;
  54357. } else {
  54358. $includeFiles = require __DIR__ . '/autoload_files.php';
  54359. }
  54360. foreach ($includeFiles as $fileIdentifier => $file) {
  54361. composerRequireComposerPhar1599644794($fileIdentifier, $file);
  54362. }
  54363. return $loader;
  54364. }
  54365. }
  54366. function composerRequireComposerPhar1599644794($fileIdentifier, $file)
  54367. {
  54368. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  54369. require $file;
  54370. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  54371. }
  54372. }
  54373. <?php
  54374. namespace Composer\Autoload;
  54375. class ComposerStaticInitComposerPhar1599644794
  54376. {
  54377. public static $files = array (
  54378. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  54379. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  54380. );
  54381. public static $prefixLengthsPsr4 = array (
  54382. 'S' =>
  54383. array (
  54384. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  54385. 'Symfony\\Polyfill\\Ctype\\' => 23,
  54386. 'Symfony\\Component\\Process\\' => 26,
  54387. 'Symfony\\Component\\Finder\\' => 25,
  54388. 'Symfony\\Component\\Filesystem\\' => 29,
  54389. 'Symfony\\Component\\Debug\\' => 24,
  54390. 'Symfony\\Component\\Console\\' => 26,
  54391. 'Seld\\PharUtils\\' => 15,
  54392. 'Seld\\JsonLint\\' => 14,
  54393. ),
  54394. 'P' =>
  54395. array (
  54396. 'Psr\\Log\\' => 8,
  54397. ),
  54398. 'J' =>
  54399. array (
  54400. 'JsonSchema\\' => 11,
  54401. ),
  54402. 'C' =>
  54403. array (
  54404. 'Composer\\XdebugHandler\\' => 23,
  54405. 'Composer\\Spdx\\' => 14,
  54406. 'Composer\\Semver\\' => 16,
  54407. 'Composer\\CaBundle\\' => 18,
  54408. 'Composer\\' => 9,
  54409. ),
  54410. );
  54411. public static $prefixDirsPsr4 = array (
  54412. 'Symfony\\Polyfill\\Mbstring\\' =>
  54413. array (
  54414. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  54415. ),
  54416. 'Symfony\\Polyfill\\Ctype\\' =>
  54417. array (
  54418. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  54419. ),
  54420. 'Symfony\\Component\\Process\\' =>
  54421. array (
  54422. 0 => __DIR__ . '/..' . '/symfony/process',
  54423. ),
  54424. 'Symfony\\Component\\Finder\\' =>
  54425. array (
  54426. 0 => __DIR__ . '/..' . '/symfony/finder',
  54427. ),
  54428. 'Symfony\\Component\\Filesystem\\' =>
  54429. array (
  54430. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  54431. ),
  54432. 'Symfony\\Component\\Debug\\' =>
  54433. array (
  54434. 0 => __DIR__ . '/..' . '/symfony/debug',
  54435. ),
  54436. 'Symfony\\Component\\Console\\' =>
  54437. array (
  54438. 0 => __DIR__ . '/..' . '/symfony/console',
  54439. ),
  54440. 'Seld\\PharUtils\\' =>
  54441. array (
  54442. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  54443. ),
  54444. 'Seld\\JsonLint\\' =>
  54445. array (
  54446. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  54447. ),
  54448. 'Psr\\Log\\' =>
  54449. array (
  54450. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  54451. ),
  54452. 'JsonSchema\\' =>
  54453. array (
  54454. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  54455. ),
  54456. 'Composer\\XdebugHandler\\' =>
  54457. array (
  54458. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  54459. ),
  54460. 'Composer\\Spdx\\' =>
  54461. array (
  54462. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  54463. ),
  54464. 'Composer\\Semver\\' =>
  54465. array (
  54466. 0 => __DIR__ . '/..' . '/composer/semver/src',
  54467. ),
  54468. 'Composer\\CaBundle\\' =>
  54469. array (
  54470. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  54471. ),
  54472. 'Composer\\' =>
  54473. array (
  54474. 0 => __DIR__ . '/../..' . '/src/Composer',
  54475. ),
  54476. );
  54477. public static function getInitializer(ClassLoader $loader)
  54478. {
  54479. return \Closure::bind(function () use ($loader) {
  54480. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1599644794::$prefixLengthsPsr4;
  54481. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1599644794::$prefixDirsPsr4;
  54482. }, null, ClassLoader::class);
  54483. }
  54484. }
  54485. <?php
  54486. namespace Composer\Autoload;
  54487. class ClassLoader
  54488. {
  54489. private $prefixLengthsPsr4 = array();
  54490. private $prefixDirsPsr4 = array();
  54491. private $fallbackDirsPsr4 = array();
  54492. private $prefixesPsr0 = array();
  54493. private $fallbackDirsPsr0 = array();
  54494. private $useIncludePath = false;
  54495. private $classMap = array();
  54496. private $classMapAuthoritative = false;
  54497. private $missingClasses = array();
  54498. private $apcuPrefix;
  54499. public function getPrefixes()
  54500. {
  54501. if (!empty($this->prefixesPsr0)) {
  54502. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  54503. }
  54504. return array();
  54505. }
  54506. public function getPrefixesPsr4()
  54507. {
  54508. return $this->prefixDirsPsr4;
  54509. }
  54510. public function getFallbackDirs()
  54511. {
  54512. return $this->fallbackDirsPsr0;
  54513. }
  54514. public function getFallbackDirsPsr4()
  54515. {
  54516. return $this->fallbackDirsPsr4;
  54517. }
  54518. public function getClassMap()
  54519. {
  54520. return $this->classMap;
  54521. }
  54522. public function addClassMap(array $classMap)
  54523. {
  54524. if ($this->classMap) {
  54525. $this->classMap = array_merge($this->classMap, $classMap);
  54526. } else {
  54527. $this->classMap = $classMap;
  54528. }
  54529. }
  54530. public function add($prefix, $paths, $prepend = false)
  54531. {
  54532. if (!$prefix) {
  54533. if ($prepend) {
  54534. $this->fallbackDirsPsr0 = array_merge(
  54535. (array) $paths,
  54536. $this->fallbackDirsPsr0
  54537. );
  54538. } else {
  54539. $this->fallbackDirsPsr0 = array_merge(
  54540. $this->fallbackDirsPsr0,
  54541. (array) $paths
  54542. );
  54543. }
  54544. return;
  54545. }
  54546. $first = $prefix[0];
  54547. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  54548. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  54549. return;
  54550. }
  54551. if ($prepend) {
  54552. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54553. (array) $paths,
  54554. $this->prefixesPsr0[$first][$prefix]
  54555. );
  54556. } else {
  54557. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54558. $this->prefixesPsr0[$first][$prefix],
  54559. (array) $paths
  54560. );
  54561. }
  54562. }
  54563. public function addPsr4($prefix, $paths, $prepend = false)
  54564. {
  54565. if (!$prefix) {
  54566. if ($prepend) {
  54567. $this->fallbackDirsPsr4 = array_merge(
  54568. (array) $paths,
  54569. $this->fallbackDirsPsr4
  54570. );
  54571. } else {
  54572. $this->fallbackDirsPsr4 = array_merge(
  54573. $this->fallbackDirsPsr4,
  54574. (array) $paths
  54575. );
  54576. }
  54577. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  54578. $length = strlen($prefix);
  54579. if ('\\' !== $prefix[$length - 1]) {
  54580. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54581. }
  54582. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54583. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54584. } elseif ($prepend) {
  54585. $this->prefixDirsPsr4[$prefix] = array_merge(
  54586. (array) $paths,
  54587. $this->prefixDirsPsr4[$prefix]
  54588. );
  54589. } else {
  54590. $this->prefixDirsPsr4[$prefix] = array_merge(
  54591. $this->prefixDirsPsr4[$prefix],
  54592. (array) $paths
  54593. );
  54594. }
  54595. }
  54596. public function set($prefix, $paths)
  54597. {
  54598. if (!$prefix) {
  54599. $this->fallbackDirsPsr0 = (array) $paths;
  54600. } else {
  54601. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  54602. }
  54603. }
  54604. public function setPsr4($prefix, $paths)
  54605. {
  54606. if (!$prefix) {
  54607. $this->fallbackDirsPsr4 = (array) $paths;
  54608. } else {
  54609. $length = strlen($prefix);
  54610. if ('\\' !== $prefix[$length - 1]) {
  54611. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54612. }
  54613. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54614. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54615. }
  54616. }
  54617. public function setUseIncludePath($useIncludePath)
  54618. {
  54619. $this->useIncludePath = $useIncludePath;
  54620. }
  54621. public function getUseIncludePath()
  54622. {
  54623. return $this->useIncludePath;
  54624. }
  54625. public function setClassMapAuthoritative($classMapAuthoritative)
  54626. {
  54627. $this->classMapAuthoritative = $classMapAuthoritative;
  54628. }
  54629. public function isClassMapAuthoritative()
  54630. {
  54631. return $this->classMapAuthoritative;
  54632. }
  54633. public function setApcuPrefix($apcuPrefix)
  54634. {
  54635. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  54636. }
  54637. public function getApcuPrefix()
  54638. {
  54639. return $this->apcuPrefix;
  54640. }
  54641. public function register($prepend = false)
  54642. {
  54643. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  54644. }
  54645. public function unregister()
  54646. {
  54647. spl_autoload_unregister(array($this, 'loadClass'));
  54648. }
  54649. public function loadClass($class)
  54650. {
  54651. if ($file = $this->findFile($class)) {
  54652. includeFile($file);
  54653. return true;
  54654. }
  54655. }
  54656. public function findFile($class)
  54657. {
  54658. if (isset($this->classMap[$class])) {
  54659. return $this->classMap[$class];
  54660. }
  54661. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  54662. return false;
  54663. }
  54664. if (null !== $this->apcuPrefix) {
  54665. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  54666. if ($hit) {
  54667. return $file;
  54668. }
  54669. }
  54670. $file = $this->findFileWithExtension($class, '.php');
  54671. if (false === $file && defined('HHVM_VERSION')) {
  54672. $file = $this->findFileWithExtension($class, '.hh');
  54673. }
  54674. if (null !== $this->apcuPrefix) {
  54675. apcu_add($this->apcuPrefix.$class, $file);
  54676. }
  54677. if (false === $file) {
  54678. $this->missingClasses[$class] = true;
  54679. }
  54680. return $file;
  54681. }
  54682. private function findFileWithExtension($class, $ext)
  54683. {
  54684. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  54685. $first = $class[0];
  54686. if (isset($this->prefixLengthsPsr4[$first])) {
  54687. $subPath = $class;
  54688. while (false !== $lastPos = strrpos($subPath, '\\')) {
  54689. $subPath = substr($subPath, 0, $lastPos);
  54690. $search = $subPath . '\\';
  54691. if (isset($this->prefixDirsPsr4[$search])) {
  54692. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  54693. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  54694. if (file_exists($file = $dir . $pathEnd)) {
  54695. return $file;
  54696. }
  54697. }
  54698. }
  54699. }
  54700. }
  54701. foreach ($this->fallbackDirsPsr4 as $dir) {
  54702. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  54703. return $file;
  54704. }
  54705. }
  54706. if (false !== $pos = strrpos($class, '\\')) {
  54707. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  54708. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  54709. } else {
  54710. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  54711. }
  54712. if (isset($this->prefixesPsr0[$first])) {
  54713. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  54714. if (0 === strpos($class, $prefix)) {
  54715. foreach ($dirs as $dir) {
  54716. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54717. return $file;
  54718. }
  54719. }
  54720. }
  54721. }
  54722. }
  54723. foreach ($this->fallbackDirsPsr0 as $dir) {
  54724. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54725. return $file;
  54726. }
  54727. }
  54728. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  54729. return $file;
  54730. }
  54731. return false;
  54732. }
  54733. }
  54734. function includeFile($file)
  54735. {
  54736. include $file;
  54737. }
  54738. ##
  54739. ## Bundle of CA Root Certificates
  54740. ##
  54741. ## Certificate data from Mozilla as of: Wed Jul 22 03:12:14 2020 GMT
  54742. ##
  54743. ## This is a bundle of X.509 certificates of public Certificate Authorities
  54744. ## (CA). These were automatically extracted from Mozilla's root certificates
  54745. ## file (certdata.txt). This file can be found in the mozilla source tree:
  54746. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  54747. ##
  54748. ## It contains the certificates in PEM format and therefore
  54749. ## can be directly used with curl / libcurl / php_curl, or with
  54750. ## an Apache+mod_ssl webserver for SSL client authentication.
  54751. ## Just configure this file as the SSLCACertificateFile.
  54752. ##
  54753. ## Conversion done with mk-ca-bundle.pl version 1.28.
  54754. ## SHA256: cc6408bd4be7fbfb8699bdb40ccb7f6de5780d681d87785ea362646e4dad5e8e
  54755. ##
  54756. GlobalSign Root CA
  54757. ==================
  54758. -----BEGIN CERTIFICATE-----
  54759. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  54760. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  54761. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  54762. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  54763. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  54764. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  54765. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  54766. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  54767. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  54768. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  54769. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  54770. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  54771. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  54772. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  54773. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  54774. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  54775. -----END CERTIFICATE-----
  54776. GlobalSign Root CA - R2
  54777. =======================
  54778. -----BEGIN CERTIFICATE-----
  54779. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  54780. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  54781. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  54782. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  54783. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  54784. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  54785. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  54786. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  54787. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  54788. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  54789. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  54790. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  54791. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  54792. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  54793. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  54794. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  54795. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  54796. -----END CERTIFICATE-----
  54797. Entrust.net Premium 2048 Secure Server CA
  54798. =========================================
  54799. -----BEGIN CERTIFICATE-----
  54800. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  54801. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  54802. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  54803. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  54804. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  54805. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  54806. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  54807. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54808. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  54809. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  54810. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  54811. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  54812. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  54813. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  54814. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  54815. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  54816. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  54817. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  54818. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  54819. -----END CERTIFICATE-----
  54820. Baltimore CyberTrust Root
  54821. =========================
  54822. -----BEGIN CERTIFICATE-----
  54823. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  54824. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  54825. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  54826. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  54827. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  54828. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  54829. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  54830. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  54831. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  54832. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  54833. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  54834. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  54835. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  54836. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  54837. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  54838. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  54839. -----END CERTIFICATE-----
  54840. Entrust Root Certification Authority
  54841. ====================================
  54842. -----BEGIN CERTIFICATE-----
  54843. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  54844. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  54845. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  54846. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  54847. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  54848. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  54849. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  54850. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54851. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  54852. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  54853. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  54854. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  54855. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  54856. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  54857. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  54858. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  54859. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  54860. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  54861. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  54862. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  54863. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  54864. -----END CERTIFICATE-----
  54865. GeoTrust Global CA
  54866. ==================
  54867. -----BEGIN CERTIFICATE-----
  54868. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  54869. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  54870. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  54871. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  54872. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  54873. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  54874. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  54875. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  54876. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  54877. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  54878. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  54879. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  54880. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  54881. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  54882. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  54883. Mw==
  54884. -----END CERTIFICATE-----
  54885. GeoTrust Universal CA
  54886. =====================
  54887. -----BEGIN CERTIFICATE-----
  54888. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54889. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  54890. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  54891. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  54892. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  54893. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  54894. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  54895. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  54896. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  54897. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  54898. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  54899. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  54900. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  54901. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  54902. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  54903. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  54904. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  54905. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  54906. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  54907. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  54908. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  54909. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  54910. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  54911. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  54912. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  54913. -----END CERTIFICATE-----
  54914. GeoTrust Universal CA 2
  54915. =======================
  54916. -----BEGIN CERTIFICATE-----
  54917. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54918. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  54919. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  54920. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  54921. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  54922. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  54923. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  54924. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  54925. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  54926. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  54927. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  54928. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  54929. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  54930. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  54931. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  54932. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  54933. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  54934. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  54935. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  54936. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  54937. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  54938. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  54939. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  54940. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  54941. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  54942. -----END CERTIFICATE-----
  54943. Comodo AAA Services root
  54944. ========================
  54945. -----BEGIN CERTIFICATE-----
  54946. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  54947. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  54948. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  54949. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  54950. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  54951. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54952. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  54953. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  54954. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  54955. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  54956. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  54957. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  54958. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  54959. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  54960. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  54961. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  54962. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  54963. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  54964. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  54965. -----END CERTIFICATE-----
  54966. QuoVadis Root CA
  54967. ================
  54968. -----BEGIN CERTIFICATE-----
  54969. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  54970. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  54971. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  54972. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  54973. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  54974. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  54975. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  54976. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  54977. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  54978. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  54979. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  54980. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  54981. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  54982. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  54983. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  54984. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  54985. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  54986. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  54987. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  54988. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  54989. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  54990. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  54991. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  54992. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  54993. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  54994. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  54995. 5nrQNiOKSnQ2+Q==
  54996. -----END CERTIFICATE-----
  54997. QuoVadis Root CA 2
  54998. ==================
  54999. -----BEGIN CERTIFICATE-----
  55000. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  55001. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  55002. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55003. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55004. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  55005. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  55006. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  55007. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  55008. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  55009. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  55010. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  55011. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  55012. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  55013. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  55014. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  55015. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  55016. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  55017. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  55018. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  55019. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  55020. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  55021. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  55022. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  55023. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  55024. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  55025. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  55026. -----END CERTIFICATE-----
  55027. QuoVadis Root CA 3
  55028. ==================
  55029. -----BEGIN CERTIFICATE-----
  55030. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  55031. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  55032. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55033. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55034. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  55035. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  55036. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  55037. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  55038. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  55039. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  55040. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  55041. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  55042. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  55043. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  55044. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  55045. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  55046. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  55047. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  55048. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  55049. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  55050. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  55051. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  55052. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  55053. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  55054. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  55055. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  55056. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  55057. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  55058. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  55059. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  55060. -----END CERTIFICATE-----
  55061. Security Communication Root CA
  55062. ==============================
  55063. -----BEGIN CERTIFICATE-----
  55064. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55065. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55066. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55067. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55068. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  55069. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  55070. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  55071. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  55072. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  55073. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  55074. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  55075. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  55076. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  55077. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  55078. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  55079. FL39vmwLAw==
  55080. -----END CERTIFICATE-----
  55081. Sonera Class 2 Root CA
  55082. ======================
  55083. -----BEGIN CERTIFICATE-----
  55084. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  55085. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  55086. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  55087. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  55088. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  55089. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  55090. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  55091. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  55092. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  55093. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  55094. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  55095. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  55096. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  55097. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  55098. llpwrN9M
  55099. -----END CERTIFICATE-----
  55100. XRamp Global CA Root
  55101. ====================
  55102. -----BEGIN CERTIFICATE-----
  55103. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  55104. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  55105. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  55106. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  55107. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  55108. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  55109. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  55110. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  55111. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  55112. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  55113. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  55114. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55115. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  55116. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  55117. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  55118. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  55119. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  55120. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  55121. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  55122. -----END CERTIFICATE-----
  55123. Go Daddy Class 2 CA
  55124. ===================
  55125. -----BEGIN CERTIFICATE-----
  55126. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  55127. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  55128. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  55129. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  55130. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  55131. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  55132. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  55133. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  55134. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  55135. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  55136. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  55137. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  55138. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  55139. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  55140. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  55141. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  55142. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  55143. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  55144. vZ8=
  55145. -----END CERTIFICATE-----
  55146. Starfield Class 2 CA
  55147. ====================
  55148. -----BEGIN CERTIFICATE-----
  55149. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  55150. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  55151. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  55152. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  55153. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  55154. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  55155. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  55156. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  55157. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  55158. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  55159. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  55160. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  55161. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  55162. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  55163. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  55164. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  55165. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  55166. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  55167. QBFGmh95DmK/D5fs4C8fF5Q=
  55168. -----END CERTIFICATE-----
  55169. Taiwan GRCA
  55170. ===========
  55171. -----BEGIN CERTIFICATE-----
  55172. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  55173. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  55174. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  55175. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55176. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  55177. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  55178. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  55179. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  55180. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  55181. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  55182. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  55183. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  55184. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  55185. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  55186. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  55187. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  55188. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  55189. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  55190. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  55191. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  55192. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  55193. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  55194. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  55195. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  55196. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  55197. -----END CERTIFICATE-----
  55198. DigiCert Assured ID Root CA
  55199. ===========================
  55200. -----BEGIN CERTIFICATE-----
  55201. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  55202. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  55203. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  55204. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  55205. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  55206. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  55207. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  55208. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  55209. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  55210. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  55211. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  55212. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  55213. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  55214. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  55215. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  55216. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  55217. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  55218. -----END CERTIFICATE-----
  55219. DigiCert Global Root CA
  55220. =======================
  55221. -----BEGIN CERTIFICATE-----
  55222. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  55223. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  55224. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  55225. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  55226. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  55227. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  55228. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  55229. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  55230. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  55231. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  55232. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  55233. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  55234. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  55235. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  55236. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  55237. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  55238. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  55239. -----END CERTIFICATE-----
  55240. DigiCert High Assurance EV Root CA
  55241. ==================================
  55242. -----BEGIN CERTIFICATE-----
  55243. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  55244. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  55245. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  55246. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  55247. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  55248. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  55249. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  55250. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  55251. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  55252. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  55253. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  55254. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  55255. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  55256. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  55257. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  55258. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  55259. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  55260. -----END CERTIFICATE-----
  55261. DST Root CA X3
  55262. ==============
  55263. -----BEGIN CERTIFICATE-----
  55264. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  55265. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  55266. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  55267. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  55268. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  55269. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  55270. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  55271. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  55272. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  55273. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  55274. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  55275. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  55276. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  55277. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  55278. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  55279. -----END CERTIFICATE-----
  55280. SwissSign Gold CA - G2
  55281. ======================
  55282. -----BEGIN CERTIFICATE-----
  55283. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  55284. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  55285. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  55286. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  55287. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  55288. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  55289. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  55290. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  55291. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  55292. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  55293. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  55294. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  55295. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  55296. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  55297. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  55298. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  55299. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  55300. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  55301. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  55302. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  55303. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  55304. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  55305. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  55306. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  55307. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  55308. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  55309. -----END CERTIFICATE-----
  55310. SwissSign Silver CA - G2
  55311. ========================
  55312. -----BEGIN CERTIFICATE-----
  55313. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  55314. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  55315. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  55316. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  55317. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  55318. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  55319. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  55320. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  55321. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  55322. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  55323. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  55324. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  55325. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  55326. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  55327. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  55328. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  55329. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  55330. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  55331. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  55332. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  55333. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  55334. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  55335. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  55336. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  55337. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  55338. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  55339. -----END CERTIFICATE-----
  55340. GeoTrust Primary Certification Authority
  55341. ========================================
  55342. -----BEGIN CERTIFICATE-----
  55343. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  55344. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  55345. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  55346. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  55347. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  55348. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  55349. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  55350. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  55351. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  55352. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55353. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  55354. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  55355. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  55356. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  55357. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  55358. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  55359. -----END CERTIFICATE-----
  55360. thawte Primary Root CA
  55361. ======================
  55362. -----BEGIN CERTIFICATE-----
  55363. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  55364. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55365. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55366. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  55367. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  55368. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  55369. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  55370. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  55371. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  55372. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  55373. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  55374. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  55375. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  55376. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  55377. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  55378. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  55379. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  55380. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  55381. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  55382. -----END CERTIFICATE-----
  55383. VeriSign Class 3 Public Primary Certification Authority - G5
  55384. ============================================================
  55385. -----BEGIN CERTIFICATE-----
  55386. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  55387. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55388. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55389. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  55390. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  55391. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  55392. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  55393. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  55394. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  55395. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  55396. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  55397. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  55398. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  55399. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  55400. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  55401. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  55402. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  55403. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  55404. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  55405. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  55406. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  55407. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  55408. -----END CERTIFICATE-----
  55409. SecureTrust CA
  55410. ==============
  55411. -----BEGIN CERTIFICATE-----
  55412. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  55413. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  55414. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  55415. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  55416. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  55417. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  55418. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  55419. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  55420. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  55421. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  55422. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  55423. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55424. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  55425. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  55426. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  55427. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  55428. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  55429. -----END CERTIFICATE-----
  55430. Secure Global CA
  55431. ================
  55432. -----BEGIN CERTIFICATE-----
  55433. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  55434. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  55435. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  55436. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  55437. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  55438. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  55439. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  55440. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  55441. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  55442. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55443. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  55444. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  55445. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  55446. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  55447. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  55448. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  55449. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  55450. -----END CERTIFICATE-----
  55451. COMODO Certification Authority
  55452. ==============================
  55453. -----BEGIN CERTIFICATE-----
  55454. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  55455. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  55456. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  55457. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  55458. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  55459. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55460. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  55461. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  55462. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  55463. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  55464. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  55465. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  55466. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  55467. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  55468. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  55469. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  55470. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  55471. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  55472. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  55473. -----END CERTIFICATE-----
  55474. Network Solutions Certificate Authority
  55475. =======================================
  55476. -----BEGIN CERTIFICATE-----
  55477. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  55478. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  55479. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  55480. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  55481. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  55482. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  55483. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  55484. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  55485. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  55486. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  55487. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  55488. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  55489. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  55490. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  55491. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  55492. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  55493. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  55494. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  55495. -----END CERTIFICATE-----
  55496. COMODO ECC Certification Authority
  55497. ==================================
  55498. -----BEGIN CERTIFICATE-----
  55499. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  55500. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  55501. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  55502. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  55503. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  55504. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  55505. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  55506. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  55507. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  55508. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  55509. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  55510. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  55511. -----END CERTIFICATE-----
  55512. OISTE WISeKey Global Root GA CA
  55513. ===============================
  55514. -----BEGIN CERTIFICATE-----
  55515. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  55516. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  55517. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  55518. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  55519. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  55520. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  55521. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  55522. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  55523. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  55524. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  55525. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  55526. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  55527. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55528. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  55529. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  55530. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  55531. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  55532. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  55533. -----END CERTIFICATE-----
  55534. Certigna
  55535. ========
  55536. -----BEGIN CERTIFICATE-----
  55537. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  55538. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  55539. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  55540. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  55541. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  55542. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  55543. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  55544. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  55545. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  55546. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  55547. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  55548. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  55549. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  55550. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  55551. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  55552. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  55553. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  55554. -----END CERTIFICATE-----
  55555. Cybertrust Global Root
  55556. ======================
  55557. -----BEGIN CERTIFICATE-----
  55558. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  55559. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  55560. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  55561. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  55562. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  55563. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  55564. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  55565. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  55566. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  55567. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  55568. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  55569. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  55570. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  55571. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  55572. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  55573. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  55574. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  55575. -----END CERTIFICATE-----
  55576. ePKI Root Certification Authority
  55577. =================================
  55578. -----BEGIN CERTIFICATE-----
  55579. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  55580. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  55581. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  55582. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  55583. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  55584. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  55585. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  55586. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  55587. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  55588. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  55589. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  55590. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  55591. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  55592. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  55593. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  55594. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  55595. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  55596. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  55597. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  55598. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  55599. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  55600. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  55601. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  55602. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  55603. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  55604. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  55605. -----END CERTIFICATE-----
  55606. certSIGN ROOT CA
  55607. ================
  55608. -----BEGIN CERTIFICATE-----
  55609. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  55610. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  55611. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  55612. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  55613. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  55614. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  55615. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  55616. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  55617. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  55618. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  55619. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  55620. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  55621. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  55622. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  55623. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  55624. -----END CERTIFICATE-----
  55625. GeoTrust Primary Certification Authority - G3
  55626. =============================================
  55627. -----BEGIN CERTIFICATE-----
  55628. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  55629. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  55630. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  55631. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  55632. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  55633. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  55634. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  55635. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  55636. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  55637. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  55638. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  55639. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  55640. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  55641. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  55642. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  55643. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  55644. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  55645. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  55646. -----END CERTIFICATE-----
  55647. thawte Primary Root CA - G2
  55648. ===========================
  55649. -----BEGIN CERTIFICATE-----
  55650. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  55651. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  55652. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  55653. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  55654. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  55655. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  55656. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  55657. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  55658. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  55659. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  55660. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  55661. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  55662. -----END CERTIFICATE-----
  55663. thawte Primary Root CA - G3
  55664. ===========================
  55665. -----BEGIN CERTIFICATE-----
  55666. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  55667. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55668. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55669. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  55670. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  55671. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  55672. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  55673. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55674. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  55675. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  55676. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  55677. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  55678. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  55679. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  55680. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  55681. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  55682. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  55683. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  55684. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  55685. -----END CERTIFICATE-----
  55686. GeoTrust Primary Certification Authority - G2
  55687. =============================================
  55688. -----BEGIN CERTIFICATE-----
  55689. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  55690. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  55691. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  55692. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  55693. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  55694. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  55695. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  55696. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  55697. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  55698. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  55699. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  55700. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  55701. npaqBA+K
  55702. -----END CERTIFICATE-----
  55703. VeriSign Universal Root Certification Authority
  55704. ===============================================
  55705. -----BEGIN CERTIFICATE-----
  55706. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  55707. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55708. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55709. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  55710. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  55711. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  55712. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  55713. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  55714. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  55715. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  55716. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  55717. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  55718. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  55719. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  55720. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  55721. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  55722. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  55723. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  55724. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  55725. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  55726. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  55727. mJO37M2CYfE45k+XmCpajQ==
  55728. -----END CERTIFICATE-----
  55729. VeriSign Class 3 Public Primary Certification Authority - G4
  55730. ============================================================
  55731. -----BEGIN CERTIFICATE-----
  55732. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  55733. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  55734. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  55735. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  55736. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  55737. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  55738. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  55739. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  55740. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  55741. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  55742. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  55743. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  55744. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  55745. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  55746. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  55747. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  55748. -----END CERTIFICATE-----
  55749. NetLock Arany (Class Gold) Főtanúsítvány
  55750. ========================================
  55751. -----BEGIN CERTIFICATE-----
  55752. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  55753. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  55754. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  55755. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  55756. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  55757. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  55758. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  55759. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  55760. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  55761. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  55762. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  55763. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  55764. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  55765. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  55766. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  55767. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  55768. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  55769. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  55770. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  55771. -----END CERTIFICATE-----
  55772. Hongkong Post Root CA 1
  55773. =======================
  55774. -----BEGIN CERTIFICATE-----
  55775. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  55776. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  55777. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  55778. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  55779. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  55780. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  55781. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  55782. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  55783. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  55784. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  55785. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  55786. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  55787. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  55788. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  55789. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  55790. -----END CERTIFICATE-----
  55791. SecureSign RootCA11
  55792. ===================
  55793. -----BEGIN CERTIFICATE-----
  55794. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  55795. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  55796. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  55797. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  55798. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  55799. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  55800. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  55801. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  55802. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  55803. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  55804. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  55805. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  55806. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  55807. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  55808. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  55809. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  55810. -----END CERTIFICATE-----
  55811. Microsec e-Szigno Root CA 2009
  55812. ==============================
  55813. -----BEGIN CERTIFICATE-----
  55814. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  55815. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  55816. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  55817. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  55818. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  55819. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  55820. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  55821. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  55822. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  55823. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  55824. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  55825. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  55826. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  55827. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  55828. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  55829. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  55830. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  55831. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  55832. LXpUq3DDfSJlgnCW
  55833. -----END CERTIFICATE-----
  55834. GlobalSign Root CA - R3
  55835. =======================
  55836. -----BEGIN CERTIFICATE-----
  55837. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  55838. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  55839. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  55840. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  55841. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  55842. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  55843. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  55844. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  55845. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  55846. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55847. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  55848. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  55849. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  55850. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  55851. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  55852. kpeDMdmztcpHWD9f
  55853. -----END CERTIFICATE-----
  55854. Autoridad de Certificacion Firmaprofesional CIF A62634068
  55855. =========================================================
  55856. -----BEGIN CERTIFICATE-----
  55857. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  55858. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  55859. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  55860. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  55861. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  55862. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  55863. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  55864. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  55865. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  55866. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  55867. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  55868. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  55869. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  55870. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  55871. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  55872. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  55873. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  55874. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  55875. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  55876. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  55877. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  55878. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  55879. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  55880. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  55881. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  55882. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  55883. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  55884. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  55885. -----END CERTIFICATE-----
  55886. Izenpe.com
  55887. ==========
  55888. -----BEGIN CERTIFICATE-----
  55889. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  55890. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  55891. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  55892. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  55893. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  55894. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  55895. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  55896. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  55897. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  55898. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  55899. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  55900. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  55901. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  55902. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  55903. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  55904. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  55905. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55906. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  55907. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  55908. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  55909. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  55910. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  55911. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  55912. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  55913. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  55914. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  55915. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  55916. -----END CERTIFICATE-----
  55917. Chambers of Commerce Root - 2008
  55918. ================================
  55919. -----BEGIN CERTIFICATE-----
  55920. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  55921. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55922. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55923. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  55924. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  55925. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  55926. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  55927. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  55928. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  55929. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  55930. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  55931. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  55932. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  55933. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  55934. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  55935. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  55936. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  55937. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  55938. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  55939. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  55940. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  55941. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  55942. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  55943. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  55944. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  55945. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  55946. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  55947. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  55948. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  55949. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  55950. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  55951. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  55952. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  55953. -----END CERTIFICATE-----
  55954. Global Chambersign Root - 2008
  55955. ==============================
  55956. -----BEGIN CERTIFICATE-----
  55957. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  55958. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55959. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55960. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  55961. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  55962. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  55963. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  55964. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  55965. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  55966. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  55967. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  55968. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  55969. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  55970. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  55971. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  55972. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  55973. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  55974. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  55975. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  55976. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  55977. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  55978. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  55979. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  55980. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  55981. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  55982. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  55983. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  55984. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  55985. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  55986. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  55987. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  55988. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  55989. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  55990. -----END CERTIFICATE-----
  55991. Go Daddy Root Certificate Authority - G2
  55992. ========================================
  55993. -----BEGIN CERTIFICATE-----
  55994. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  55995. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  55996. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  55997. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  55998. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  55999. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  56000. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  56001. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  56002. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  56003. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  56004. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  56005. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  56006. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  56007. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  56008. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  56009. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  56010. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  56011. -----END CERTIFICATE-----
  56012. Starfield Root Certificate Authority - G2
  56013. =========================================
  56014. -----BEGIN CERTIFICATE-----
  56015. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56016. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56017. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  56018. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  56019. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  56020. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  56021. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  56022. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  56023. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  56024. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  56025. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  56026. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56027. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  56028. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  56029. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  56030. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  56031. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  56032. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  56033. -----END CERTIFICATE-----
  56034. Starfield Services Root Certificate Authority - G2
  56035. ==================================================
  56036. -----BEGIN CERTIFICATE-----
  56037. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56038. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56039. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  56040. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  56041. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  56042. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  56043. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  56044. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  56045. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  56046. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  56047. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  56048. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  56049. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  56050. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  56051. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  56052. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  56053. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  56054. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  56055. -----END CERTIFICATE-----
  56056. AffirmTrust Commercial
  56057. ======================
  56058. -----BEGIN CERTIFICATE-----
  56059. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56060. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  56061. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56062. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  56063. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  56064. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  56065. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  56066. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  56067. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  56068. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56069. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  56070. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  56071. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  56072. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  56073. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  56074. -----END CERTIFICATE-----
  56075. AffirmTrust Networking
  56076. ======================
  56077. -----BEGIN CERTIFICATE-----
  56078. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56079. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  56080. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56081. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  56082. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  56083. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  56084. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  56085. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  56086. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  56087. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56088. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  56089. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  56090. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  56091. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  56092. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  56093. -----END CERTIFICATE-----
  56094. AffirmTrust Premium
  56095. ===================
  56096. -----BEGIN CERTIFICATE-----
  56097. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  56098. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  56099. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  56100. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56101. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  56102. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  56103. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  56104. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  56105. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  56106. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  56107. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  56108. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  56109. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  56110. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  56111. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  56112. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  56113. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  56114. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  56115. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  56116. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  56117. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  56118. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  56119. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  56120. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  56121. -----END CERTIFICATE-----
  56122. AffirmTrust Premium ECC
  56123. =======================
  56124. -----BEGIN CERTIFICATE-----
  56125. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  56126. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  56127. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  56128. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  56129. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  56130. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  56131. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  56132. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  56133. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  56134. eQ==
  56135. -----END CERTIFICATE-----
  56136. Certum Trusted Network CA
  56137. =========================
  56138. -----BEGIN CERTIFICATE-----
  56139. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  56140. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  56141. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  56142. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  56143. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  56144. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  56145. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  56146. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  56147. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  56148. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  56149. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  56150. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  56151. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  56152. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  56153. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  56154. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  56155. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  56156. -----END CERTIFICATE-----
  56157. TWCA Root Certification Authority
  56158. =================================
  56159. -----BEGIN CERTIFICATE-----
  56160. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  56161. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  56162. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  56163. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  56164. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  56165. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  56166. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  56167. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  56168. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  56169. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  56170. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  56171. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  56172. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  56173. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  56174. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  56175. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  56176. -----END CERTIFICATE-----
  56177. Security Communication RootCA2
  56178. ==============================
  56179. -----BEGIN CERTIFICATE-----
  56180. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  56181. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  56182. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  56183. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  56184. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56185. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  56186. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  56187. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  56188. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  56189. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  56190. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  56191. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  56192. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  56193. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  56194. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  56195. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  56196. -----END CERTIFICATE-----
  56197. EC-ACC
  56198. ======
  56199. -----BEGIN CERTIFICATE-----
  56200. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  56201. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  56202. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  56203. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  56204. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  56205. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  56206. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  56207. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  56208. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  56209. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  56210. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  56211. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  56212. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  56213. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  56214. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  56215. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  56216. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  56217. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  56218. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  56219. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  56220. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  56221. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  56222. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  56223. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  56224. 5EI=
  56225. -----END CERTIFICATE-----
  56226. Hellenic Academic and Research Institutions RootCA 2011
  56227. =======================================================
  56228. -----BEGIN CERTIFICATE-----
  56229. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  56230. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  56231. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56232. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  56233. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56234. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  56235. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56236. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  56237. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  56238. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  56239. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  56240. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  56241. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  56242. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  56243. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  56244. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  56245. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  56246. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  56247. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  56248. -----END CERTIFICATE-----
  56249. Actalis Authentication Root CA
  56250. ==============================
  56251. -----BEGIN CERTIFICATE-----
  56252. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  56253. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  56254. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  56255. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  56256. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  56257. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  56258. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  56259. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  56260. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  56261. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  56262. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  56263. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  56264. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  56265. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  56266. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  56267. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  56268. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  56269. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  56270. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  56271. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  56272. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  56273. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  56274. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  56275. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  56276. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  56277. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  56278. -----END CERTIFICATE-----
  56279. Trustis FPS Root CA
  56280. ===================
  56281. -----BEGIN CERTIFICATE-----
  56282. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  56283. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  56284. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  56285. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  56286. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  56287. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  56288. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  56289. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  56290. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  56291. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  56292. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  56293. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  56294. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  56295. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  56296. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  56297. iB6XzCGcKQENZetX2fNXlrtIzYE=
  56298. -----END CERTIFICATE-----
  56299. Buypass Class 2 Root CA
  56300. =======================
  56301. -----BEGIN CERTIFICATE-----
  56302. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56303. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  56304. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56305. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  56306. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  56307. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  56308. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  56309. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  56310. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  56311. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  56312. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  56313. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  56314. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  56315. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56316. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56317. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  56318. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  56319. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  56320. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  56321. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  56322. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  56323. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  56324. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  56325. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  56326. rJgWVqA=
  56327. -----END CERTIFICATE-----
  56328. Buypass Class 3 Root CA
  56329. =======================
  56330. -----BEGIN CERTIFICATE-----
  56331. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56332. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  56333. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56334. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  56335. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  56336. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  56337. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  56338. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  56339. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  56340. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  56341. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  56342. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  56343. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  56344. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56345. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56346. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  56347. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  56348. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  56349. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  56350. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  56351. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  56352. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  56353. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  56354. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  56355. Cp/HuZc=
  56356. -----END CERTIFICATE-----
  56357. T-TeleSec GlobalRoot Class 3
  56358. ============================
  56359. -----BEGIN CERTIFICATE-----
  56360. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56361. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56362. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  56363. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56364. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56365. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  56366. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  56367. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  56368. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  56369. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  56370. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  56371. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  56372. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  56373. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  56374. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  56375. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  56376. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  56377. -----END CERTIFICATE-----
  56378. EE Certification Centre Root CA
  56379. ===============================
  56380. -----BEGIN CERTIFICATE-----
  56381. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  56382. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  56383. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  56384. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  56385. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  56386. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  56387. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  56388. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  56389. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  56390. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  56391. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  56392. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  56393. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  56394. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  56395. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  56396. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  56397. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  56398. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  56399. dcGWxZ0=
  56400. -----END CERTIFICATE-----
  56401. D-TRUST Root Class 3 CA 2 2009
  56402. ==============================
  56403. -----BEGIN CERTIFICATE-----
  56404. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56405. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  56406. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  56407. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  56408. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  56409. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  56410. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  56411. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  56412. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  56413. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  56414. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  56415. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  56416. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  56417. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  56418. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  56419. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  56420. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  56421. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  56422. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  56423. -----END CERTIFICATE-----
  56424. D-TRUST Root Class 3 CA 2 EV 2009
  56425. =================================
  56426. -----BEGIN CERTIFICATE-----
  56427. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56428. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56429. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56430. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56431. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  56432. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  56433. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  56434. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  56435. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  56436. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  56437. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  56438. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  56439. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  56440. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  56441. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  56442. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  56443. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  56444. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  56445. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  56446. w9y4AyHqnxbxLFS1
  56447. -----END CERTIFICATE-----
  56448. CA Disig Root R2
  56449. ================
  56450. -----BEGIN CERTIFICATE-----
  56451. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  56452. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  56453. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  56454. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  56455. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  56456. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  56457. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  56458. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  56459. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  56460. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  56461. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  56462. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  56463. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  56464. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  56465. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  56466. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  56467. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  56468. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  56469. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  56470. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  56471. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  56472. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  56473. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  56474. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  56475. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  56476. -----END CERTIFICATE-----
  56477. ACCVRAIZ1
  56478. =========
  56479. -----BEGIN CERTIFICATE-----
  56480. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  56481. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  56482. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  56483. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  56484. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  56485. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  56486. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  56487. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  56488. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  56489. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  56490. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  56491. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  56492. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  56493. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  56494. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  56495. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  56496. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  56497. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  56498. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  56499. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  56500. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  56501. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  56502. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  56503. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  56504. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  56505. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  56506. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  56507. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  56508. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  56509. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  56510. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  56511. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  56512. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  56513. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  56514. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  56515. EfbRD0tVNEYqi4Y7
  56516. -----END CERTIFICATE-----
  56517. TWCA Global Root CA
  56518. ===================
  56519. -----BEGIN CERTIFICATE-----
  56520. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  56521. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  56522. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  56523. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  56524. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  56525. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  56526. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  56527. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  56528. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  56529. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  56530. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  56531. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  56532. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  56533. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  56534. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  56535. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  56536. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  56537. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  56538. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  56539. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  56540. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  56541. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  56542. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  56543. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  56544. -----END CERTIFICATE-----
  56545. TeliaSonera Root CA v1
  56546. ======================
  56547. -----BEGIN CERTIFICATE-----
  56548. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  56549. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  56550. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  56551. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  56552. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  56553. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  56554. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  56555. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  56556. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  56557. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  56558. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  56559. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  56560. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  56561. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  56562. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  56563. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  56564. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  56565. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  56566. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  56567. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  56568. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  56569. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  56570. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  56571. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  56572. -----END CERTIFICATE-----
  56573. E-Tugra Certification Authority
  56574. ===============================
  56575. -----BEGIN CERTIFICATE-----
  56576. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  56577. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  56578. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  56579. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  56580. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  56581. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  56582. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  56583. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56584. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  56585. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  56586. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  56587. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  56588. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  56589. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  56590. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  56591. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  56592. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  56593. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  56594. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  56595. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  56596. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  56597. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  56598. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  56599. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  56600. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  56601. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  56602. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  56603. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  56604. C7TbO6Orb1wdtn7os4I07QZcJA==
  56605. -----END CERTIFICATE-----
  56606. T-TeleSec GlobalRoot Class 2
  56607. ============================
  56608. -----BEGIN CERTIFICATE-----
  56609. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56610. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56611. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  56612. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56613. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56614. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  56615. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  56616. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  56617. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  56618. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  56619. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  56620. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  56621. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  56622. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  56623. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  56624. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  56625. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  56626. -----END CERTIFICATE-----
  56627. Atos TrustedRoot 2011
  56628. =====================
  56629. -----BEGIN CERTIFICATE-----
  56630. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  56631. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  56632. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  56633. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  56634. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  56635. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  56636. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  56637. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  56638. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  56639. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  56640. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  56641. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  56642. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  56643. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  56644. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  56645. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  56646. -----END CERTIFICATE-----
  56647. QuoVadis Root CA 1 G3
  56648. =====================
  56649. -----BEGIN CERTIFICATE-----
  56650. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56651. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56652. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  56653. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  56654. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  56655. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  56656. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  56657. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  56658. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  56659. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  56660. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  56661. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  56662. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  56663. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56664. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  56665. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  56666. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  56667. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  56668. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  56669. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  56670. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  56671. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  56672. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  56673. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  56674. hMJKzRwuJIczYOXD
  56675. -----END CERTIFICATE-----
  56676. QuoVadis Root CA 2 G3
  56677. =====================
  56678. -----BEGIN CERTIFICATE-----
  56679. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56680. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56681. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  56682. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  56683. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  56684. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  56685. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  56686. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  56687. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  56688. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  56689. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  56690. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  56691. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  56692. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56693. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  56694. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  56695. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  56696. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  56697. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  56698. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  56699. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  56700. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  56701. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  56702. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  56703. O3jtZsSOeWmD3n+M
  56704. -----END CERTIFICATE-----
  56705. QuoVadis Root CA 3 G3
  56706. =====================
  56707. -----BEGIN CERTIFICATE-----
  56708. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  56709. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56710. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  56711. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  56712. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  56713. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  56714. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  56715. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  56716. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  56717. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  56718. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  56719. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  56720. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  56721. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56722. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  56723. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  56724. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  56725. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  56726. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  56727. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  56728. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  56729. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  56730. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  56731. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  56732. PpxxVJkES/1Y+Zj0
  56733. -----END CERTIFICATE-----
  56734. DigiCert Assured ID Root G2
  56735. ===========================
  56736. -----BEGIN CERTIFICATE-----
  56737. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  56738. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  56739. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  56740. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  56741. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  56742. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  56743. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  56744. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  56745. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  56746. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  56747. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  56748. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  56749. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  56750. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  56751. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  56752. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  56753. IhNzbM8m9Yop5w==
  56754. -----END CERTIFICATE-----
  56755. DigiCert Assured ID Root G3
  56756. ===========================
  56757. -----BEGIN CERTIFICATE-----
  56758. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  56759. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  56760. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56761. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56762. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  56763. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  56764. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  56765. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  56766. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  56767. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  56768. 1vUhZscv6pZjamVFkpUBtA==
  56769. -----END CERTIFICATE-----
  56770. DigiCert Global Root G2
  56771. =======================
  56772. -----BEGIN CERTIFICATE-----
  56773. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  56774. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  56775. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  56776. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  56777. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  56778. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  56779. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  56780. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  56781. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  56782. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  56783. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  56784. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  56785. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  56786. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  56787. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  56788. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  56789. MrY=
  56790. -----END CERTIFICATE-----
  56791. DigiCert Global Root G3
  56792. =======================
  56793. -----BEGIN CERTIFICATE-----
  56794. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  56795. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  56796. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  56797. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  56798. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  56799. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  56800. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  56801. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  56802. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  56803. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  56804. VOKa5Vt8sycX
  56805. -----END CERTIFICATE-----
  56806. DigiCert Trusted Root G4
  56807. ========================
  56808. -----BEGIN CERTIFICATE-----
  56809. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  56810. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  56811. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56812. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56813. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  56814. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  56815. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  56816. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  56817. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  56818. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  56819. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  56820. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  56821. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  56822. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  56823. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  56824. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  56825. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  56826. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  56827. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  56828. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  56829. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  56830. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  56831. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  56832. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  56833. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  56834. 82Z+
  56835. -----END CERTIFICATE-----
  56836. COMODO RSA Certification Authority
  56837. ==================================
  56838. -----BEGIN CERTIFICATE-----
  56839. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  56840. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  56841. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  56842. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  56843. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  56844. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  56845. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  56846. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  56847. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  56848. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  56849. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  56850. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  56851. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  56852. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  56853. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  56854. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  56855. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  56856. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  56857. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  56858. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  56859. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  56860. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  56861. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  56862. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  56863. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  56864. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  56865. LaZRfyHBNVOFBkpdn627G190
  56866. -----END CERTIFICATE-----
  56867. USERTrust RSA Certification Authority
  56868. =====================================
  56869. -----BEGIN CERTIFICATE-----
  56870. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  56871. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56872. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56873. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  56874. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56875. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56876. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  56877. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  56878. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  56879. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  56880. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  56881. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  56882. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  56883. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  56884. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  56885. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  56886. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  56887. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  56888. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  56889. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  56890. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  56891. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  56892. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  56893. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  56894. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  56895. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  56896. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  56897. -----END CERTIFICATE-----
  56898. USERTrust ECC Certification Authority
  56899. =====================================
  56900. -----BEGIN CERTIFICATE-----
  56901. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  56902. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56903. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56904. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  56905. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56906. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56907. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  56908. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  56909. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  56910. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  56911. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  56912. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  56913. -----END CERTIFICATE-----
  56914. GlobalSign ECC Root CA - R4
  56915. ===========================
  56916. -----BEGIN CERTIFICATE-----
  56917. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  56918. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56919. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56920. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56921. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  56922. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  56923. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  56924. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  56925. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  56926. -----END CERTIFICATE-----
  56927. GlobalSign ECC Root CA - R5
  56928. ===========================
  56929. -----BEGIN CERTIFICATE-----
  56930. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  56931. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56932. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56933. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56934. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  56935. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  56936. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  56937. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  56938. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  56939. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  56940. -----END CERTIFICATE-----
  56941. Staat der Nederlanden Root CA - G3
  56942. ==================================
  56943. -----BEGIN CERTIFICATE-----
  56944. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56945. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56946. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  56947. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  56948. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  56949. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  56950. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  56951. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  56952. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  56953. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  56954. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  56955. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  56956. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  56957. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  56958. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  56959. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  56960. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  56961. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  56962. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  56963. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  56964. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  56965. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  56966. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  56967. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  56968. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  56969. -----END CERTIFICATE-----
  56970. Staat der Nederlanden EV Root CA
  56971. ================================
  56972. -----BEGIN CERTIFICATE-----
  56973. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56974. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56975. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  56976. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  56977. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  56978. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  56979. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  56980. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  56981. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  56982. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  56983. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  56984. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  56985. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  56986. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  56987. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  56988. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  56989. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  56990. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  56991. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  56992. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  56993. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  56994. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  56995. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  56996. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  56997. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  56998. -----END CERTIFICATE-----
  56999. IdenTrust Commercial Root CA 1
  57000. ==============================
  57001. -----BEGIN CERTIFICATE-----
  57002. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  57003. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  57004. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  57005. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  57006. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  57007. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  57008. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  57009. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  57010. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  57011. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  57012. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  57013. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  57014. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  57015. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  57016. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  57017. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  57018. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  57019. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  57020. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  57021. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  57022. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  57023. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  57024. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  57025. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  57026. cGzM7vRX+Bi6hG6H
  57027. -----END CERTIFICATE-----
  57028. IdenTrust Public Sector Root CA 1
  57029. =================================
  57030. -----BEGIN CERTIFICATE-----
  57031. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  57032. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  57033. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  57034. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  57035. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  57036. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  57037. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  57038. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  57039. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  57040. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  57041. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  57042. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  57043. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  57044. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  57045. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  57046. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  57047. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  57048. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  57049. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  57050. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  57051. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  57052. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  57053. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  57054. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  57055. 3Wl9af0AVqW3rLatt8o+Ae+c
  57056. -----END CERTIFICATE-----
  57057. Entrust Root Certification Authority - G2
  57058. =========================================
  57059. -----BEGIN CERTIFICATE-----
  57060. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  57061. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  57062. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  57063. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  57064. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  57065. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  57066. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  57067. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  57068. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  57069. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  57070. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  57071. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  57072. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  57073. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  57074. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  57075. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  57076. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  57077. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  57078. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  57079. e4pIb4tF9g==
  57080. -----END CERTIFICATE-----
  57081. Entrust Root Certification Authority - EC1
  57082. ==========================================
  57083. -----BEGIN CERTIFICATE-----
  57084. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  57085. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  57086. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  57087. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  57088. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  57089. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  57090. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  57091. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  57092. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  57093. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  57094. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  57095. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  57096. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  57097. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  57098. -----END CERTIFICATE-----
  57099. CFCA EV ROOT
  57100. ============
  57101. -----BEGIN CERTIFICATE-----
  57102. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  57103. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  57104. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  57105. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  57106. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  57107. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  57108. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  57109. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  57110. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  57111. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  57112. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  57113. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  57114. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  57115. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  57116. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  57117. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  57118. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  57119. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  57120. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  57121. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  57122. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  57123. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  57124. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  57125. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  57126. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  57127. -----END CERTIFICATE-----
  57128. OISTE WISeKey Global Root GB CA
  57129. ===============================
  57130. -----BEGIN CERTIFICATE-----
  57131. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  57132. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  57133. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  57134. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  57135. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  57136. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  57137. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  57138. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  57139. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  57140. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  57141. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  57142. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  57143. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  57144. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  57145. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  57146. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  57147. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  57148. -----END CERTIFICATE-----
  57149. SZAFIR ROOT CA2
  57150. ===============
  57151. -----BEGIN CERTIFICATE-----
  57152. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  57153. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  57154. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  57155. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  57156. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  57157. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  57158. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  57159. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  57160. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  57161. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  57162. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  57163. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  57164. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  57165. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  57166. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  57167. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  57168. -----END CERTIFICATE-----
  57169. Certum Trusted Network CA 2
  57170. ===========================
  57171. -----BEGIN CERTIFICATE-----
  57172. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  57173. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  57174. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  57175. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  57176. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  57177. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  57178. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  57179. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  57180. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  57181. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  57182. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  57183. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  57184. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  57185. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  57186. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  57187. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57188. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  57189. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  57190. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  57191. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  57192. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  57193. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  57194. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  57195. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  57196. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  57197. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  57198. zAYspsbiDrW5viSP
  57199. -----END CERTIFICATE-----
  57200. Hellenic Academic and Research Institutions RootCA 2015
  57201. =======================================================
  57202. -----BEGIN CERTIFICATE-----
  57203. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  57204. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  57205. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  57206. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  57207. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  57208. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  57209. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  57210. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  57211. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  57212. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  57213. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  57214. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  57215. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  57216. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  57217. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  57218. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  57219. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57220. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  57221. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  57222. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  57223. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  57224. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  57225. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  57226. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  57227. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  57228. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  57229. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  57230. p/UsQu0yrbYhnr68
  57231. -----END CERTIFICATE-----
  57232. Hellenic Academic and Research Institutions ECC RootCA 2015
  57233. ===========================================================
  57234. -----BEGIN CERTIFICATE-----
  57235. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  57236. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  57237. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  57238. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  57239. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  57240. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  57241. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  57242. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  57243. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  57244. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  57245. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  57246. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  57247. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  57248. -----END CERTIFICATE-----
  57249. ISRG Root X1
  57250. ============
  57251. -----BEGIN CERTIFICATE-----
  57252. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  57253. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  57254. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  57255. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  57256. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  57257. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  57258. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  57259. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  57260. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  57261. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  57262. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  57263. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  57264. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  57265. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  57266. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  57267. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  57268. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  57269. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  57270. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  57271. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  57272. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  57273. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  57274. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  57275. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  57276. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  57277. -----END CERTIFICATE-----
  57278. AC RAIZ FNMT-RCM
  57279. ================
  57280. -----BEGIN CERTIFICATE-----
  57281. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  57282. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  57283. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  57284. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57285. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  57286. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  57287. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  57288. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  57289. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  57290. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  57291. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  57292. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  57293. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  57294. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  57295. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  57296. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  57297. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  57298. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  57299. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  57300. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  57301. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  57302. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  57303. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  57304. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  57305. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  57306. -----END CERTIFICATE-----
  57307. Amazon Root CA 1
  57308. ================
  57309. -----BEGIN CERTIFICATE-----
  57310. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  57311. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  57312. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57313. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  57314. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  57315. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  57316. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  57317. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  57318. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  57319. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  57320. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  57321. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  57322. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  57323. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  57324. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  57325. -----END CERTIFICATE-----
  57326. Amazon Root CA 2
  57327. ================
  57328. -----BEGIN CERTIFICATE-----
  57329. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  57330. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  57331. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57332. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57333. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  57334. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  57335. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  57336. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  57337. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  57338. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  57339. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  57340. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  57341. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  57342. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  57343. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  57344. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  57345. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  57346. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  57347. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  57348. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  57349. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  57350. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  57351. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  57352. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  57353. -----END CERTIFICATE-----
  57354. Amazon Root CA 3
  57355. ================
  57356. -----BEGIN CERTIFICATE-----
  57357. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  57358. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  57359. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57360. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  57361. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  57362. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  57363. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  57364. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  57365. -----END CERTIFICATE-----
  57366. Amazon Root CA 4
  57367. ================
  57368. -----BEGIN CERTIFICATE-----
  57369. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  57370. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  57371. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57372. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  57373. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  57374. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  57375. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  57376. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  57377. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  57378. -----END CERTIFICATE-----
  57379. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  57380. =============================================
  57381. -----BEGIN CERTIFICATE-----
  57382. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  57383. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  57384. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  57385. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  57386. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  57387. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  57388. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  57389. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  57390. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  57391. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  57392. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  57393. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  57394. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  57395. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  57396. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  57397. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  57398. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  57399. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  57400. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  57401. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  57402. -----END CERTIFICATE-----
  57403. GDCA TrustAUTH R5 ROOT
  57404. ======================
  57405. -----BEGIN CERTIFICATE-----
  57406. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  57407. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  57408. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  57409. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  57410. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  57411. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  57412. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  57413. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  57414. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  57415. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  57416. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  57417. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  57418. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  57419. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  57420. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  57421. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  57422. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  57423. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  57424. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  57425. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  57426. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  57427. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  57428. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  57429. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  57430. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  57431. -----END CERTIFICATE-----
  57432. TrustCor RootCert CA-1
  57433. ======================
  57434. -----BEGIN CERTIFICATE-----
  57435. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  57436. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57437. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57438. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  57439. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  57440. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  57441. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  57442. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  57443. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  57444. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  57445. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  57446. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  57447. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  57448. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  57449. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  57450. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  57451. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  57452. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  57453. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  57454. -----END CERTIFICATE-----
  57455. TrustCor RootCert CA-2
  57456. ======================
  57457. -----BEGIN CERTIFICATE-----
  57458. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  57459. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  57460. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  57461. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  57462. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  57463. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  57464. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  57465. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  57466. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  57467. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  57468. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  57469. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  57470. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  57471. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  57472. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  57473. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  57474. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  57475. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  57476. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  57477. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  57478. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  57479. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  57480. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  57481. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  57482. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  57483. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  57484. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  57485. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  57486. -----END CERTIFICATE-----
  57487. TrustCor ECA-1
  57488. ==============
  57489. -----BEGIN CERTIFICATE-----
  57490. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  57491. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57492. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57493. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  57494. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  57495. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  57496. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  57497. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  57498. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  57499. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  57500. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  57501. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  57502. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  57503. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  57504. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  57505. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  57506. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  57507. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  57508. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  57509. -----END CERTIFICATE-----
  57510. SSL.com Root Certification Authority RSA
  57511. ========================================
  57512. -----BEGIN CERTIFICATE-----
  57513. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  57514. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  57515. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  57516. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57517. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  57518. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  57519. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  57520. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  57521. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  57522. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  57523. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  57524. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  57525. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  57526. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  57527. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  57528. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  57529. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  57530. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  57531. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  57532. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  57533. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  57534. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  57535. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  57536. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  57537. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  57538. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  57539. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  57540. -----END CERTIFICATE-----
  57541. SSL.com Root Certification Authority ECC
  57542. ========================================
  57543. -----BEGIN CERTIFICATE-----
  57544. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  57545. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  57546. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  57547. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  57548. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  57549. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  57550. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  57551. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  57552. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  57553. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  57554. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  57555. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  57556. -----END CERTIFICATE-----
  57557. SSL.com EV Root Certification Authority RSA R2
  57558. ==============================================
  57559. -----BEGIN CERTIFICATE-----
  57560. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  57561. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  57562. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  57563. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  57564. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  57565. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  57566. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  57567. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  57568. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  57569. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  57570. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  57571. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  57572. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  57573. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  57574. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  57575. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  57576. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  57577. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  57578. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  57579. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  57580. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  57581. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  57582. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  57583. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  57584. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  57585. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  57586. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  57587. -----END CERTIFICATE-----
  57588. SSL.com EV Root Certification Authority ECC
  57589. ===========================================
  57590. -----BEGIN CERTIFICATE-----
  57591. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  57592. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  57593. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  57594. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57595. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  57596. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  57597. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  57598. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  57599. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  57600. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  57601. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  57602. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  57603. -----END CERTIFICATE-----
  57604. GlobalSign Root CA - R6
  57605. =======================
  57606. -----BEGIN CERTIFICATE-----
  57607. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  57608. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  57609. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  57610. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  57611. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  57612. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  57613. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  57614. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  57615. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  57616. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  57617. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  57618. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  57619. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  57620. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  57621. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  57622. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  57623. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  57624. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  57625. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  57626. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  57627. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  57628. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  57629. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  57630. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  57631. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  57632. -----END CERTIFICATE-----
  57633. OISTE WISeKey Global Root GC CA
  57634. ===============================
  57635. -----BEGIN CERTIFICATE-----
  57636. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  57637. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  57638. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  57639. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  57640. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  57641. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  57642. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  57643. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  57644. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  57645. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  57646. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  57647. -----END CERTIFICATE-----
  57648. GTS Root R1
  57649. ===========
  57650. -----BEGIN CERTIFICATE-----
  57651. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57652. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57653. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57654. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  57655. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  57656. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  57657. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  57658. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  57659. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  57660. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  57661. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  57662. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  57663. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  57664. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57665. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  57666. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  57667. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  57668. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  57669. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  57670. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  57671. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  57672. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  57673. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  57674. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  57675. CFF1pkgl
  57676. -----END CERTIFICATE-----
  57677. GTS Root R2
  57678. ===========
  57679. -----BEGIN CERTIFICATE-----
  57680. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57681. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57682. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57683. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  57684. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  57685. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  57686. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  57687. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  57688. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  57689. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  57690. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  57691. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  57692. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  57693. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57694. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  57695. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  57696. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  57697. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  57698. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  57699. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  57700. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  57701. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  57702. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  57703. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  57704. o/DUhgkC
  57705. -----END CERTIFICATE-----
  57706. GTS Root R3
  57707. ===========
  57708. -----BEGIN CERTIFICATE-----
  57709. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57710. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57711. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57712. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  57713. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  57714. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  57715. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  57716. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  57717. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  57718. KaqW04MjyaR7YbPMAuhd
  57719. -----END CERTIFICATE-----
  57720. GTS Root R4
  57721. ===========
  57722. -----BEGIN CERTIFICATE-----
  57723. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57724. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57725. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57726. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  57727. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  57728. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  57729. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  57730. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  57731. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  57732. zPKwTdb+mciUqXWi4w==
  57733. -----END CERTIFICATE-----
  57734. UCA Global G2 Root
  57735. ==================
  57736. -----BEGIN CERTIFICATE-----
  57737. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  57738. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  57739. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  57740. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  57741. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  57742. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  57743. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  57744. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  57745. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  57746. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  57747. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  57748. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  57749. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  57750. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  57751. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  57752. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  57753. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  57754. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  57755. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  57756. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  57757. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  57758. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  57759. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  57760. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  57761. -----END CERTIFICATE-----
  57762. UCA Extended Validation Root
  57763. ============================
  57764. -----BEGIN CERTIFICATE-----
  57765. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  57766. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  57767. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  57768. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  57769. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  57770. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  57771. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  57772. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  57773. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  57774. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  57775. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  57776. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  57777. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  57778. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  57779. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  57780. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  57781. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  57782. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  57783. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  57784. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  57785. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  57786. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  57787. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  57788. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  57789. dhh2n1ax
  57790. -----END CERTIFICATE-----
  57791. Certigna Root CA
  57792. ================
  57793. -----BEGIN CERTIFICATE-----
  57794. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  57795. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  57796. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  57797. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  57798. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  57799. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  57800. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  57801. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  57802. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  57803. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  57804. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  57805. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  57806. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  57807. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  57808. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  57809. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  57810. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  57811. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  57812. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  57813. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  57814. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  57815. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  57816. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  57817. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  57818. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  57819. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  57820. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  57821. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  57822. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  57823. -----END CERTIFICATE-----
  57824. emSign Root CA - G1
  57825. ===================
  57826. -----BEGIN CERTIFICATE-----
  57827. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  57828. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  57829. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  57830. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  57831. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  57832. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  57833. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  57834. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  57835. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  57836. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  57837. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  57838. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  57839. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  57840. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  57841. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  57842. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  57843. iN66zB+Afko=
  57844. -----END CERTIFICATE-----
  57845. emSign ECC Root CA - G3
  57846. =======================
  57847. -----BEGIN CERTIFICATE-----
  57848. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  57849. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  57850. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  57851. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  57852. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  57853. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  57854. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  57855. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  57856. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  57857. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  57858. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  57859. -----END CERTIFICATE-----
  57860. emSign Root CA - C1
  57861. ===================
  57862. -----BEGIN CERTIFICATE-----
  57863. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  57864. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  57865. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  57866. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  57867. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  57868. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  57869. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  57870. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  57871. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  57872. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  57873. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  57874. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  57875. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  57876. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  57877. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  57878. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  57879. -----END CERTIFICATE-----
  57880. emSign ECC Root CA - C3
  57881. =======================
  57882. -----BEGIN CERTIFICATE-----
  57883. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  57884. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  57885. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  57886. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  57887. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  57888. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  57889. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  57890. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  57891. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  57892. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  57893. -----END CERTIFICATE-----
  57894. Hongkong Post Root CA 3
  57895. =======================
  57896. -----BEGIN CERTIFICATE-----
  57897. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  57898. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  57899. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  57900. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  57901. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  57902. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  57903. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  57904. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  57905. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  57906. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  57907. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  57908. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  57909. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  57910. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  57911. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  57912. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  57913. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  57914. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  57915. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  57916. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  57917. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  57918. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  57919. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  57920. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  57921. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  57922. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  57923. dBb9HxEGmpv0
  57924. -----END CERTIFICATE-----
  57925. Entrust Root Certification Authority - G4
  57926. =========================================
  57927. -----BEGIN CERTIFICATE-----
  57928. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  57929. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  57930. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  57931. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  57932. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  57933. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  57934. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  57935. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  57936. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  57937. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  57938. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  57939. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  57940. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  57941. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  57942. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  57943. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  57944. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  57945. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  57946. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  57947. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  57948. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  57949. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  57950. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  57951. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  57952. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  57953. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  57954. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  57955. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  57956. kcpG2om3PVODLAgfi49T3f+sHw==
  57957. -----END CERTIFICATE-----
  57958. Microsoft ECC Root Certificate Authority 2017
  57959. =============================================
  57960. -----BEGIN CERTIFICATE-----
  57961. MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  57962. UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
  57963. IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
  57964. MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
  57965. NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
  57966. BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
  57967. thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
  57968. eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
  57969. +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
  57970. Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
  57971. eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
  57972. -----END CERTIFICATE-----
  57973. Microsoft RSA Root Certificate Authority 2017
  57974. =============================================
  57975. -----BEGIN CERTIFICATE-----
  57976. MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
  57977. EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
  57978. UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
  57979. NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
  57980. MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
  57981. ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
  57982. 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
  57983. S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
  57984. 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
  57985. dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
  57986. yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
  57987. MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
  57988. lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
  57989. 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
  57990. ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
  57991. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
  57992. NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
  57993. 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
  57994. dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
  57995. +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
  57996. /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
  57997. AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
  57998. ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
  57999. 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
  58000. c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
  58001. 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
  58002. -----END CERTIFICATE-----
  58003. e-Szigno Root CA 2017
  58004. =====================
  58005. -----BEGIN CERTIFICATE-----
  58006. MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
  58007. DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
  58008. MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
  58009. Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
  58010. CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
  58011. Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
  58012. s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
  58013. A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
  58014. vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
  58015. tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
  58016. svxyqltZ+efcMQ==
  58017. -----END CERTIFICATE-----
  58018. certSIGN Root CA G2
  58019. ===================
  58020. -----BEGIN CERTIFICATE-----
  58021. MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
  58022. EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
  58023. MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
  58024. TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  58025. ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
  58026. N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
  58027. abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
  58028. wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
  58029. dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
  58030. ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
  58031. jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
  58032. 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
  58033. z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
  58034. iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
  58035. DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
  58036. ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
  58037. b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
  58038. /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
  58039. 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
  58040. BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
  58041. atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
  58042. Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
  58043. NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
  58044. 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
  58045. -----END CERTIFICATE-----
  58046. <?php
  58047. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  58048. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  58049. }
  58050. setlocale(LC_ALL, 'C');
  58051. require __DIR__.'/../src/bootstrap.php';
  58052. use Composer\Console\Application;
  58053. use Composer\XdebugHandler\XdebugHandler;
  58054. error_reporting(-1);
  58055. // Restart without Xdebug
  58056. $xdebug = new XdebugHandler('Composer', '--ansi');
  58057. $xdebug->check();
  58058. unset($xdebug);
  58059. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  58060. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  58061. exit(1);
  58062. }
  58063. if (function_exists('ini_set')) {
  58064. @ini_set('display_errors', 1);
  58065. $memoryInBytes = function ($value) {
  58066. $unit = strtolower(substr($value, -1, 1));
  58067. $value = (int) $value;
  58068. switch($unit) {
  58069. case 'g':
  58070. $value *= 1024;
  58071. // no break (cumulative multiplier)
  58072. case 'm':
  58073. $value *= 1024;
  58074. // no break (cumulative multiplier)
  58075. case 'k':
  58076. $value *= 1024;
  58077. }
  58078. return $value;
  58079. };
  58080. $memoryLimit = trim(ini_get('memory_limit'));
  58081. // Increase memory_limit if it is lower than 1.5GB
  58082. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  58083. @ini_set('memory_limit', '1536M');
  58084. }
  58085. // Set user defined memory limit
  58086. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  58087. @ini_set('memory_limit', $memoryLimit);
  58088. }
  58089. unset($memoryInBytes, $memoryLimit);
  58090. }
  58091. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  58092. // run the command application
  58093. $application = new Application();
  58094. $application->run();
  58095. Copyright (c) Nils Adermann, Jordi Boggiano
  58096. Permission is hereby granted, free of charge, to any person obtaining a copy
  58097. of this software and associated documentation files (the "Software"), to deal
  58098. in the Software without restriction, including without limitation the rights
  58099. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58100. copies of the Software, and to permit persons to whom the Software is furnished
  58101. to do so, subject to the following conditions:
  58102. The above copyright notice and this permission notice shall be included in all
  58103. copies or substantial portions of the Software.
  58104. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58105. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  58106. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  58107. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  58108. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  58109. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58110. THE SOFTWARE.
  58111. Ûù`x‘5mâí‡Ø;å`³Zlü„���GBMB